Forum Discussion
YTD average time - reset each year
- 4 years ago
You are comparing the year of the response time to today, not to the date from your calendar table. Try
YTD_Average Time = var maxDate = MAX ( 'Calendar'[Date] ) CALCULATE ( AVERAGE ( COMPLAINTS[RESPONSE_TIME] ); COMPLAINTS[RESPONSE_TIME] <> BLANK (); FILTER ( VALUES ( COMPLAINTS[RESPONSE_TIME] ); COMPLAINTS[RESPONSE_TIME] < maxDate ); YEAR ( COMPLAINTS[RESPONSE_TIME] ) = YEAR ( maxDate ) ) - 4 years ago
Hi jorge_oliveira ,
You need another Measure to help you with that.
YTD_Reset_Year = CALCULATE ( [YTD_Average Time], FILTER ( 'Calendar', YEAR ( 'Calendar'[Date] ) = SELECTEDVALUE ( 'Calendar'[Year] ) //If you just need the YTD of 2022, please replace SELECTEDVALUE part with 2022 ) )Then the result will look like this.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Hi jorge_oliveira ,
You need another Measure to help you with that.
YTD_Reset_Year =
CALCULATE (
[YTD_Average Time],
FILTER (
'Calendar',
YEAR ( 'Calendar'[Date] ) = SELECTEDVALUE ( 'Calendar'[Year] )
//If you just need the YTD of 2022, please replace SELECTEDVALUE part with 2022
)
)
Then the result will look like this.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun