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.
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!
Solved! Go to Solution.
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_ )
|
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. |
The code above works fine. See it all at work in the attached file.
|
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!
Can you provide the example data above in text-tabular format, so that it can be copied, rather than on a pic?
|
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. |
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
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_ )
|
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?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
96 | |
81 | |
74 | |
66 |
User | Count |
---|---|
126 | |
105 | |
103 | |
81 | |
72 |