Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Year to Date % change calculation problem

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 )

 

1 REPLY 1
ValtteriN
Super User
Super User

Hi,

Here is how to do this:

Data:

ValtteriN_1-1702286308653.png

 

Dax:

Measure 9 =

var _thisyearmax = CALCULATE(SUM('Table (16)'[Value]),ALL('Calendar'[Date]),'Calendar'[Month]=MONTH(MAX('Table (16)'[Date])),'Calendar'[Year]=YEAR(TODAY()))
var _lastyearmax = CALCULATE(SUM('Table (16)'[Value]),ALL('Calendar'[Date]),'Calendar'[Month]=12,'Calendar'[Year]=YEAR(TODAY())-1)

return
DIVIDE(_thisyearmax-_lastyearmax,_lastyearmax,0)

Since last year's max month is always 12 I am using that here. 


Now if we validate the results: (40-30)/(30) = 0,33

Second test:
ValtteriN_2-1702286645075.pngValtteriN_3-1702286678475.png

 

(50-30)/(30)= 0.67



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/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.