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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rohit403
Helper I
Helper I

YOY calculation for vertical data defined data using dax

Hi All,

 

I need your advise and help in calculating YOY (year on year) percentage change. The data as well as the result required is in the below format. I have a date table too, whose screenshot I have also provided. I must mention that I was able to do this by inserting a column in the Power BI table view with help provided from this forum. However, as my project is on a server, I cant edit the table and can just create a new measure. However I am struggling with the DAX formula for the same. Please help:

 

Data

 

CustomerKPIunitPeriodValue
VerizonTotal revenueUSD millionQ1/201629029.95849
VerizonTotal revenueUSD millionQ1/201727959.3623
VerizonCapexUSD millionQ1/201610029.95849
VerizonCapexUSD millionQ1/20178959.3623
BhartiTotal revenueUSD millionQ1/201634567
BhartiTotal revenueUSD millionQ1/201733000
BhartiCapexUSD millionQ1/201615222
BhartiCapexUSD millionQ1/201713655

 

Output

 

CustomerKPIunitPeriodValue yoy%
VerizonTotal revenueUSD millionQ1/201629029.95849  
VerizonTotal revenueUSD millionQ1/201727959.3623 -3.7%
VerizonCapexUSD millionQ1/201610029.95849  
VerizonCapexUSD millionQ1/20178959.3623 -10.7%
BhartiTotal revenueUSD millionQ1/201634567  
BhartiTotal revenueUSD millionQ1/201733000 -4.5%
BhartiCapexUSD millionQ1/201615222  
BhartiCapexUSD millionQ1/201713655 -10.3%

 

 

Date Table content where relationships are already made and cant be edited:

 

Date.JPG

Thanks,

 

Rohit

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @rohit403 ,

 

Your period fields seems not stored valid date values. You can try to use following measure formula if it works for your requirement:

YOY =
VAR currPeriod =
    MAX ( Table[Period] )
VAR curr =
    CALCULATE (
        SUM ( Table[Value] ),
        FILTER ( ALLSELECTED ( Table ), Table[Period] = currPeriod ),
        VALUES ( Table[Customer] ),
        VALUES ( Table[KPI] )
    )
VAR prev =
    curr
        = CALCULATE (
            SUM ( Table[Value] ),
            FILTER (
                ALLSELECTED ( Table ),
                Table[Period]
                    = LEFT ( currPeriod, 3 )
                        & VALUE ( RIGHT ( currPeriod, 4 ) ) - 1
            ),
            VALUES ( Table[Customer] ),
            VALUES ( Table[KPI] )
        )
RETURN
    IF ( prev <> BLANK (), DIVIDE ( curr - prev, prev, 0 ) )

If above not help, please share a pbix file with some sample data for test.

 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @rohit403 ,

 

Your period fields seems not stored valid date values. You can try to use following measure formula if it works for your requirement:

YOY =
VAR currPeriod =
    MAX ( Table[Period] )
VAR curr =
    CALCULATE (
        SUM ( Table[Value] ),
        FILTER ( ALLSELECTED ( Table ), Table[Period] = currPeriod ),
        VALUES ( Table[Customer] ),
        VALUES ( Table[KPI] )
    )
VAR prev =
    curr
        = CALCULATE (
            SUM ( Table[Value] ),
            FILTER (
                ALLSELECTED ( Table ),
                Table[Period]
                    = LEFT ( currPeriod, 3 )
                        & VALUE ( RIGHT ( currPeriod, 4 ) ) - 1
            ),
            VALUES ( Table[Customer] ),
            VALUES ( Table[KPI] )
        )
RETURN
    IF ( prev <> BLANK (), DIVIDE ( curr - prev, prev, 0 ) )

If above not help, please share a pbix file with some sample data for test.

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.