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

View all the Fabric Data Days sessions on demand. View schedule

Reply
KKVerma
Regular Visitor

Dax: Calculate YOY growth but ignore the result of very first year DAX

Hi Team,

 

I have a simple table like below: I want to calculate YOY growth which i have calculalated. However, the very first year in the context is 2021 and YOY is (current year minus last year). I want to return YOY sales to be blank. but currently it will return the same amount as sum for the year because there is no data in last year(e.g. 2020). I have tried multple ways to manipulate dax formula but it did not work. Could you please assist?

 

Formulas:

Current Year = SUM(FctTable[Amount])
Last Year = CALCULATE([Current Year],SAMEPERIODLASTYEAR(DimDate[Date]))
YOY Growth = [Current Year]-[Last Year]

 

KKVerma_1-1722802074203.png

 

 

KKVerma_0-1722801603532.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @KKVerma ,

 

Thanks for the reply from @Greg_Deckler , please allow me to provide another insight: 

 

You can modify your measure.

 

YOY Growth = 
VAR _min_date =
    CALCULATE ( MIN ( 'Table 2'[Date] ), ALLSELECTED ( 'Table' ) )
RETURN
    IF (
        MAX ( 'Table 2'[Date] ) = _min_date,
        BLANK (),
        [_Current_Year] - [_Last_Year]
    )

vkaiyuemsft_0-1722923790629.png

 

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @KKVerma ,

 

Thanks for the reply from @Greg_Deckler , please allow me to provide another insight: 

 

You can modify your measure.

 

YOY Growth = 
VAR _min_date =
    CALCULATE ( MIN ( 'Table 2'[Date] ), ALLSELECTED ( 'Table' ) )
RETURN
    IF (
        MAX ( 'Table 2'[Date] ) = _min_date,
        BLANK (),
        [_Current_Year] - [_Last_Year]
    )

vkaiyuemsft_0-1722923790629.png

 

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

KKVerma
Regular Visitor

This would not return the correct results.  for instance if I have dataset for 10 years. 2021 to 2030. If 2024 does not have any sales. The it will return blank in your calculation whereas, i just want to return blank only for the beginning of the year from the years in current filter context 

Greg_Deckler
Community Champion
Community Champion

@KKVerma So like this?

 

YOY Growth = IF( [Last Year] = BLANK(), BLANK(), [Current Year] - [Last Year] )

 



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...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.