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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
amandabus21
Helper V
Helper V

% Change Last Year

How can I find out how to create a percent change from last year?

 

The caculation displayed in the table is: 

Accidents Per 100K Miles = DIVIDE('Datamart AccidentSummary'[Sum of PV],'Datamart AccidentSummary'[Sum of Mileage]) *100000
 
I need the percent change of "Accidents last year per 100k miles", on a monthly basis and YTD total. 

amandabus21_0-1663783025513.png

 

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@amandabus21 Here are a couple of approaches:

Better Year Over Year Change = 
    VAR __Year = MAX('Table'[Year])
    VAR __Curr = SUMX(FILTER(ALL('Table'),[Year] = __Year),[Value])
    VAR __Prev = SUMX(FILTER(ALL('Table'),[Year] = __Year - 1),[Value])
RETURN
    DIVIDE(__Curr - __Prev, __Prev, 0)



Better Year Over Year Change 2 = 
    VAR __Year = MAX('Table'[Year])
    VAR __EndDate = MAX('Table'[Date])
    VAR __StartDate = MIN('Table'[Date])
    VAR __PrevDateEnd = DATE(YEAR(__EndDate) - 1, MONTH(__EndDate), DAY(__EndDate))
    VAR __PrevDateStart = DATE(YEAR(__StartDate) - 1, MONTH(__StartDate), DAY(__StartDate))
    VAR __Curr = SUMX(FILTER(ALL('Table'),[Year] = __Year),[Value])
    VAR __Prev = SUMX(FILTER(ALL('Table'),[Date] <= __PrevDateEnd && [Date] >= __PrevDateStart),[Value])
RETURN
    DIVIDE(__Curr - __Prev, __Prev, 0)


Since you have a single table data model, the default Power BI quick measure won't work correctly.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thank you for your help!

 

So I created the measure:

 

Better Year Over Year Change =
    VAR __Year = MAX('Datamart AccidentSummary'[Fiscal_Year])
    VAR __Curr = SUMX(FILTER(ALL('Datamart AccidentSummary'),[Fiscal_Year] = __Year),[Accidents Per 100K Miles])
    VAR __Prev = SUMX(FILTER(ALL('Datamart AccidentSummary'),[Fiscal_Year] = __Year - 1),[Accidents Per 100K Miles])
RETURN
    DIVIDE(__Curr - __Prev, __Prev, 0
 
 That is giving me this:
amandabus21_1-1663792766605.png

 

which is not quite the numbers im looking for.
 
 
 Here is a better picture of what Im looking to recreate in Power BI 
 
If you see for 2016/2017 in January, the % change is -2.3%
amandabus21_0-1663792621024.png

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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