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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
egrospe17
Frequent Visitor

Measure for YoY YTD

Hello DAX Gods,

I have this table in one of my PowerBI reports that shows YoY % Revenue growth. For the most part, this looks right with the execption of the current year because we are only in September. How can I show the YoY % to only calculate vs YTD of previous year?

 

egrospe17_0-1727458366417.png

I'm using the following DAX formula for the Rev YoY Growth %:

 

Rev YoY Growth % = 
VAR _currentyear_rev = [Total Revenue]
VAR _currentyear = MAX('400_Revenue'[Year])
VAR _previouseyear_rev = CALCULATE([Total Revenue],'400_Revenue'[Year] = _currentyear - 1)
VAR _YoYGrowth = 
    DIVIDE(
            _currentyear_rev - _previouseyear_rev, _previouseyear_rev
    )
RETURN
    IF(
        HASONEVALUE('400_Revenue'[Year]),
        IF(
            NOT ISBLANK(_currentyear_rev) && NOT ISBLANK(_previouseyear_rev),
            _YoYGrowth
        )
    )

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @egrospe17 

Based on your needs, I have created the following table.

vjialongymsft_0-1728009433452.png

 

First you can use the following Measure to get the total revenue every year.

Total Revenue = 
VAR _year = [Year]
RETURN
SUMX(FILTER(ALL('Table'),'Table'[Year]=_year),'Table'[Revenue])

 

Then you can use the following Measure to get the result you want:

YoY % Revenue growth = 
VAR _year = [Year]
VAR _sameperiodtotal = CALCULATE ( [Total Revenue], DATESYTD ( SAMEPERIODLASTYEAR ( 'Table'[Date] ) ) )
VAR _maxmonth = MAXX (
            FILTER ( ALL ( 'Table' ), 'Table'[Year] = _year ),
            MONTH ( 'Table'[Date] )
        )
RETURN
    IF (
         _maxmonth< 12,
        DIVIDE (
            SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Year] = _year ), 'Table'[Revenue] ),
            SUMX (
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Year] = _year - 1
                        && MONTH ( 'Table'[Date] )
                            <= _maxmonth
                ),
                'Table'[Revenue]
            )
        )-1,
        DIVIDE (
            [Total Revenue]-_sameperiodtotal,
            _sameperiodtotal
        )
    )



 

vjialongymsft_1-1728009777307.png

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

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
Anonymous
Not applicable

Hi @egrospe17 

Based on your needs, I have created the following table.

vjialongymsft_0-1728009433452.png

 

First you can use the following Measure to get the total revenue every year.

Total Revenue = 
VAR _year = [Year]
RETURN
SUMX(FILTER(ALL('Table'),'Table'[Year]=_year),'Table'[Revenue])

 

Then you can use the following Measure to get the result you want:

YoY % Revenue growth = 
VAR _year = [Year]
VAR _sameperiodtotal = CALCULATE ( [Total Revenue], DATESYTD ( SAMEPERIODLASTYEAR ( 'Table'[Date] ) ) )
VAR _maxmonth = MAXX (
            FILTER ( ALL ( 'Table' ), 'Table'[Year] = _year ),
            MONTH ( 'Table'[Date] )
        )
RETURN
    IF (
         _maxmonth< 12,
        DIVIDE (
            SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Year] = _year ), 'Table'[Revenue] ),
            SUMX (
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Year] = _year - 1
                        && MONTH ( 'Table'[Date] )
                            <= _maxmonth
                ),
                'Table'[Revenue]
            )
        )-1,
        DIVIDE (
            [Total Revenue]-_sameperiodtotal,
            _sameperiodtotal
        )
    )



 

vjialongymsft_1-1728009777307.png

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

SachinNandanwar
Impactful Individual
Impactful Individual

VAR _previouseyear_rev = CALCULATE([Total Revenue],'400_Revenue'[Year] = _currentyear - 1)

Did you try using SAMEPERIODLASTYEAR ?



Regards,
Sachin
Check out my Blog

Hi SachinNandanwar,

How would I incorporate SAMEPERIODLASTYEAR to my existing formula? 

 

I tried following this thread but it didn't produced the result I needed. the YoY% just returned as null when I put it on a table.

https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-and-YoY-for-Measure/m-p/3536287#...

Hi @egrospe17 : So basically you need to compare Jan-Sep 2023 with Jan-Sep 2024 for calculating YoY%, right ?

For that you can use a combination of DATESYTD and SAMEPERIODLASTYEAR.

Something like 

 

CALCULATE([Total Revenue], DATESYTD(SAMEPERIODLASTYEAR('400_Revenue'[Date])))

 

 



Regards,
Sachin
Check out my Blog

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.