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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
milkmoneymike
Helper I
Helper I

Finding Percent change of a column?

Hello all

 

I am looking to find percentage change over each row from the previous day. I have two columns a date column and then a total column for each of the dates. I am having issues finding a formula to show percent change. Any information would be helpful! 

 

Capture.PNG

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @milkmoneymike 

Try this for a new calculated column. Format as %

 

Perc_Change =
VAR previousDate_ =
    CALCULATE (
        MAX ( Table1[Date] ),
        Table1[Date] < EARLIER ( Table1[Date] ),
        ALL ( Table1 )
    )
VAR currentVal_ = Table1[Count]
VAR previousVal_ =
    CALCULATE (
        DISTINCT ( Table1[Count] ),
        Table1[Date] = previousDate_,
        ALL ( Table1 )
    )
RETURN
    DIVIDE ( currentVal_ - previousVal_, previousVal_ )

 

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

6 REPLIES 6
AlB
Super User
Super User

@milkmoneymike 

The code above works fine. See it all at work in the attached file.

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Awesome it worked and thank you! 

AlB
Super User
Super User

@milkmoneymike 

Can you provide the example data above in text-tabular format, so that it can be copied, rather than on a pic?

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Sample data csv 

 

Here is the csv file of the table. you can disregard the time stamps on the dates wasnt sure how to remove those before sharing

AlB
Super User
Super User

Hi @milkmoneymike 

Try this for a new calculated column. Format as %

 

Perc_Change =
VAR previousDate_ =
    CALCULATE (
        MAX ( Table1[Date] ),
        Table1[Date] < EARLIER ( Table1[Date] ),
        ALL ( Table1 )
    )
VAR currentVal_ = Table1[Count]
VAR previousVal_ =
    CALCULATE (
        DISTINCT ( Table1[Count] ),
        Table1[Date] = previousDate_,
        ALL ( Table1 )
    )
RETURN
    DIVIDE ( currentVal_ - previousVal_, previousVal_ )

 

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Thank you for the quick reply. I tried the calculated column you suggested but it creates the column but only returns blanks. Any suggestions?

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.