Forum Discussion
Dynamic Date & Site/Location Reference in Like For Like Calculations
- Anonymous4 years ago
Hey,
I figured it out. I just integrated in my measure the minimum date that I then used in time filter for calendar year:
<div>
Measure = VAR MinimumDate = CALCULATE(MIN('Calendar'[Year]),ALLSELECTED('Calendar'[Year])) VAR Result = CALCULATE ( [LFL EBITDA Actual], FILTER ( ALL ( 'Calendar' ), 'Calendar'[Year] = ( MinimumDate ) && 'Calendar'[Month] IN VALUES ( 'Calendar'[Month] ) ) ) RETURN Result</div>
Best regards
Hi Anonymous ,
Please refer to my pbix file to see if it helps you.
Create a measure.
Measure =
CALCULATE (
[LFL EBITDA Actual],
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year]
= ( SELECTEDVALUE ( 'Calendar'[Year] ) - 1 )
&& 'Calendar'[Month] IN VALUES ( 'Calendar'[Month] )
)
)
If I have misunderstood your meaning, please provide more details with your desired output.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey, thanks a lot. This does it.
I would also like to be able to choose the previous period and not be limited to only one period back. So say when I want to compare 2022 with 2019, I would like to select these two in my year slicer the measure would then dynamically calculate the sales for these two periods, that is sales for locations that were open between these two periods, whereas current year measure would refer to 2022 and previous year measure refer to 2019 while picking only the locations that were open only in these two years.
Do you have an idea how one could achieve that?
Thanks and best regards,
- Anonymous4 years agoNot applicable
Hey,
I figured it out. I just integrated in my measure the minimum date that I then used in time filter for calendar year:
<div>
Measure = VAR MinimumDate = CALCULATE(MIN('Calendar'[Year]),ALLSELECTED('Calendar'[Year])) VAR Result = CALCULATE ( [LFL EBITDA Actual], FILTER ( ALL ( 'Calendar' ), 'Calendar'[Year] = ( MinimumDate ) && 'Calendar'[Month] IN VALUES ( 'Calendar'[Month] ) ) ) RETURN Result</div>
Best regards