Forum Discussion
MarianoV
1 year agoFrequent Visitor
LY values not in sync within different visualizations when using two different date slicers
Hi everyone! When I select a specific date from the graph, the value for the previous year only shows the value for the first selected date from the previous year slicer. For context, I have ...
Anonymous
1 year agoNot applicable
Hi MarianoV ,
Instead of using DATEDIFF in CALCULATE, you can use the PARALLELPERIOD function to dynamically calculate dates for the same period last year.
VAR CurrentDate = FIRSTDATE ( 'Dates Current Period'[Date] )
VAR PreviousDate = FIRSTDATE ( PARALLELPERIOD ( 'Dates Current Period'[Date], -1, YEAR ) )
VAR NoOfIntervalDays =
CALCULATE (
COUNTROWS (
FILTER (
ALLSELECTED ( 'Dates Current Period'[Date] ),
'Dates Current Period'[Date] >= PreviousDate &&
'Dates Current Period'[Date] <= CurrentDate
)
)
)
PARALLELPERIOD function (DAX) - DAX | Microsoft Learn
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
MarianoV
1 year agoFrequent Visitor
thanks Anonymous ! However, the NoOfIntervalDays seems to not work properly. Ideally, the NoOfIntervalDays should be equal to -364 as it would dynamically get the same day of the week LY and then calculate the total sessions. Would you know another way?