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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.