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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jonbox
Helper II
Helper II

average totals based on year and show % difference

Hi,

 

I'm looking to createa measure that averages the totals from the past 5 years (not including current year) and then compares against average of the total of current year e.g.:

 

(Average of total spend 2017, total 2018, total 2019, total 2020, total 2021), Current year spend (2022), % difference of both.

 

e.g based on below table: 

(Average total spend 2017 (20000+5000), 2018 (15000), 2019 (16000), 2020 (14500), 2021 (8000)) = 15700

Current year spend = 10000

 

% difference of average last 5fy (15700) and Current year (10000) = 44.3%

 

Project nameYearSpend
Proj1201720000
Proj220175000
Proj3201815000
Proj420191000
Proj5201915000
Proj620207000
Proj720207500
Proj820218000
Proj9202210000
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Make it dynamic for fun,

Record_2022_05_30_15_30_50_572.gif


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Make it dynamic for fun,

Record_2022_05_30_15_30_50_572.gif


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Hello

 

M1==> 

average prev years =
var maxyear=max('Average'[Year])
var nbyear=DISTINCTCOUNT('Average'[Year])-1
var amounttoaver=calculate(sum('Average'[Spend]),'Average'[Year]<>maxyear)
return
divide(amounttoaver,nbyear)
 
M2==> 
Amount Year N =
var maxyear=max('Average'[Year])
return
calculate(sum('Average'[Spend]),'Average'[Year]=maxyear)
 
Final ==> 
final pect = divide('Average'[Amount Year N],'Average'[average prev years])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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