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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
IgorKaradzic
Helper I
Helper I

DAX formula for calculating % growth of profits over period of 5 years

Hi guys, i need help with DAX calculating % growth of profits over period of, let's say, 5 years. As you will see in table below i also have different work sectors(currently 1 in table) and i want to show in table visual top 3 work sectors with fastest growing profits over a period of 5 years.


Work SectorYearYearly net profit(€)
Acommodation and food services2019€ 294
Acommodation and food services2020€ 315
Acommodation and food services2021€ 339
Acommodation and food services2022€ 392
Acommodation and food services2023€ 440
Acommodation and food services2024€ 503
1 ACCEPTED SOLUTION
v-kongfanf-msft
Community Support
Community Support

Hi @IgorKaradzic ,

 

Create a separate year column as a slicer. Then create the following formula:

result =
VAR sel_ =
    SELECTEDVALUE ( 'Date'[Year] )
VAR maxProfit =
    CALCULATE ( MAX ( 'Table'[Yearly net profit(€)] ), 'Table'[Year] = sel_ + 5 )
VAR minProfit =
    CALCULATE ( MAX ( 'Table'[Yearly net profit(€)] ), 'Table'[Year] = sel_ )
VAR per_ =
    DIVIDE ( maxProfit - minProfit, minProfit )
RETURN
    per_
1 =
IF ( RANKX ( ALL ( 'Table'[Work Sector] ), [result],, DESC ) <= 3, 1, 0 )

vkongfanfmsft_0-1716345435879.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-kongfanf-msft
Community Support
Community Support

Hi @IgorKaradzic ,

 

Create a separate year column as a slicer. Then create the following formula:

result =
VAR sel_ =
    SELECTEDVALUE ( 'Date'[Year] )
VAR maxProfit =
    CALCULATE ( MAX ( 'Table'[Yearly net profit(€)] ), 'Table'[Year] = sel_ + 5 )
VAR minProfit =
    CALCULATE ( MAX ( 'Table'[Yearly net profit(€)] ), 'Table'[Year] = sel_ )
VAR per_ =
    DIVIDE ( maxProfit - minProfit, minProfit )
RETURN
    per_
1 =
IF ( RANKX ( ALL ( 'Table'[Work Sector] ), [result],, DESC ) <= 3, 1, 0 )

vkongfanfmsft_0-1716345435879.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, it worked.

lbendlin
Super User
Super User

Please try to use a Quick Measure first. It has Year Over Year examples.  

 

Remember to add a calendar table to the data model.

 

Tried it and it also worked.Thank you for suggesting it.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors