Forum Discussion
mariahMC
Helper I
1 year agoPrevious YTD with Week Number slicer interaction
Hello, I have a visual that lists the years, WTD totals, YTD totals and YoY% based on which week of the year is selected from a slicer. I have three slicers for Region, Year and Week#. The year slic...
- 1 year ago
Hi mariahMC ,
Please try the following DAX for your Total Prev YTD measure and let me know if it achieves your desired result:Test Total Prev YTD := VAR SelectedWeek = SELECTEDVALUE('Calendar Table'[Week Number]) VAR SelectedYear = SELECTEDVALUE('Calendar Table'[Year]) RETURN CALCULATE( [Case Volume], FILTER( ALL('Calendar Table'), 'Calendar Table'[Year] = SelectedYear - 1 && 'Calendar Table'[Week Number] <= SelectedWeek ) )If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,Samson
Connect with me on LinkedIn
Check out my Blog
Going to the European Microsoft Fabric Community Conference? Check out my Session
samratpbi
Super User
1 year agoHi, it will not work since date functions are not for weekly calculations. What you can do is, create another measure like below:
Test Total PYTD =
CALCULATE (
[Case Volume],
ALL ( 'Calendar Table'[Week Number] ),
'Calendar Table'[Year] = SELECTEDVALUE ( 'Calendar Table'[Year] ) - 1
'Calendar Table'[Year] = SELECTEDVALUE ( 'Calendar Table'[Year] ) - 1
'Calendar Table'[Week Number] <= SELECTEDVALUE ( 'Calendar Table'[Week Number] )
)
If this helps to resolve your problem, then please mark it as solution, thanks - Samrat
mariahMC
Helper I
1 year agoThank you, this measure worked as well!