Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello:
I am learning how to use the time difference functions.
I have a date column in my Fact table that is connected to a Date table.
I would like to calculate YTD, QTD, MTD, Week to date sums of the Amount column.
I used the filters in the report and the calculations are correct. However, I run into issues with capturing the same using measures. For instance, today is 6/6/24. For the MTD, the calculation is correct. However, the corresponding sum for the same period from last year gives me the total June sum (not the sum from June 1-June 6).
Previous Year MTD =
CALCULATE(
[Amount],
DATESMTD(SAMEPERIODLASTYEAR('DateT'[Date]))
)
Any guidance would be much appreciated. Thanks in advance.
Solved! Go to Solution.
HI @isa2003 ,
Perhaps you can try to manually calculate the filter range based on date function instead of nested using time intelligence functions:
Time Intelligence "The Hard Way" (TITHW)
Previous Year MTD =
VAR currDate =
MAX ( 'DateT'[Date] )
VAR prevDate =
DATE ( YEAR ( currDate ) - 1, MONTH ( currDate ), DAY ( currDate ) )
RETURN
CALCULATE (
[Amount],
FILTER (
ALLSELECTED ( 'fact' ),
[Date] >= DATE ( YEAR ( prevDate ), MONTH ( prevDate ), 1 )
&& [Date] <= prevDate
)
)
Regards,
Xiaoxin Sheng
HI @isa2003 ,
Perhaps you can try to manually calculate the filter range based on date function instead of nested using time intelligence functions:
Time Intelligence "The Hard Way" (TITHW)
Previous Year MTD =
VAR currDate =
MAX ( 'DateT'[Date] )
VAR prevDate =
DATE ( YEAR ( currDate ) - 1, MONTH ( currDate ), DAY ( currDate ) )
RETURN
CALCULATE (
[Amount],
FILTER (
ALLSELECTED ( 'fact' ),
[Date] >= DATE ( YEAR ( prevDate ), MONTH ( prevDate ), 1 )
&& [Date] <= prevDate
)
)
Regards,
Xiaoxin Sheng
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |