Daily DAX : Day 338 TOTALQTD
TOTALQTD DAX Function
The TOTALQTD
function in Power BI's DAX (Data Analysis Expressions) calculates the total for a specified expression over the quarter-to-date period based on a date column.
Syntax
TOTALQTD(<expression>, <dates>[, <filter>])
- expression: The calculation to aggregate (e.g.,
SUM(Table[Sales])
). - dates: A column containing date values.
- filter (optional): A filter expression to apply to the calculation.
Purpose
TOTALQTD
returns the cumulative total of an expression from the start of the quarter to the latest date in the current context. It’s useful for financial reporting, sales tracking, or any analysis requiring quarter-to-date metrics.
Use Case
Suppose you have a sales table and want to calculate total sales from the beginning of the current quarter to the selected date in a report.
Example
Table: SalesData
Date | Sales |
---|---|
2025-01-15 | 1000 |
2025-02-10 | 1500 |
2025-03-05 | 2000 |
DAX Measure:
QuarterlySales = TOTALQTD(SUM(SalesData[Sales]), SalesData[Date])
Result: For a filter context of March 5, 2025 (Q1 2025), QuarterlySales
returns 4500 (1000 + 1500 + 2000), the total sales from January 1, 2025, to March 5, 2025.
Key Notes
- Requires a proper date table or column for accurate results.
- Resets at the start of each quarter.
- Commonly used in visuals like tables, charts, or KPIs for quarter-to-date performance tracking.
Comments
Post a Comment