Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello there
TLDR: Based on a chosen month selected with a slicer (custom "Timeline 2.4" slicer) to compare numbers with exact same month last year. So lets say the user selects April 2023, I also want to show data for April 2022, especially the difference in %.
I've been searching and searching and tried different solutions without luck.
So I have some electricity sensor data for lets say 3 years based upon this calculated measure:
pervious sales =
VAR selectedmonth = CALCULATE(SUM(Measurements[numericValue),
[Month] = SELECTEDVALUE([Month]) && [Year] = Year(SELECTEDVALUE([Year]))
)
VAR selectedyear = CALCULATE(SUM(Measurements[numericValue),
[Month] = EOMONTH(SELECTEDVALUE([Month]), -12) && [Year] = Year(SELECTEDVALUE([Year]) - 1)
)
RETURN
DIVIDE(selectedmonth - selectedyear, selectedyear)
Hi,
Your sameperiod lastyear approach was close Here is a working pattern:
CALCULATE ( selectedmeasure(), SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )
Replace selectedmeasure with [Calculated_consumption] and use calendar table from your model. Your fact table should have 1:M relationship with the calendar.
For % change:
VAR LastYear = CALCULATE ( selectedmeasure(), SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) ) RETURN DIVIDE(selectedmeasure()-LastYear,LastYear)
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
19 | |
14 | |
10 | |
7 |