Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hey!
I am trying to calculate a measure that takes the sum of values from last years max month (December) and compares it against this years latest visible month sum and then calculates the % change between these two value. The current year returns a correct value but previous year returns blank. Previous year and max month variables return correct values but when I wrap this up in a calculation it stops working. I've been stuck here for quite a some time so help is highly appreciated. Here is the DAX measure that I have created.
Fleet Growth % =
VAR current_year =
SELECTEDVALUE ( vDimCalendar[Year] )
VAR _LATEST =
CALCULATE (
SUM ( Assets[TotalAssets] ),
FILTER (
vDimCalendar,
vDimCalendar[Month] = MAX ( vDimCalendar[Month] )
&& vDimCalendar[Year] = current_year
)
)
VAR previous_year = current_year - 1
VAR max_month =
MAXX ( vDimCalendar, vDimCalendar[MonthNumber] )
VAR _PREVIOUS =
CALCULATE (
SUM ( Assets[TotalAssets] ),
FILTER (
vDimCalendar,
( vDimCalendar[MonthNumber] = max_month )
&& ( vDimCalendar[Year] = previous_year )
)
)
RETURN
DIVIDE ( _LATEST - _PREVIOUS, _PREVIOUS, 0 )
Hi,
Here is how to do this:
Data:
Dax:
(50-30)/(30)= 0.67
Proud to be a Super User!
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
9 | |
6 |