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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
pfarahani
Helper II
Helper II

Calculate Percentage Change from Previous Row

Hello,

 

I am trying to create a DAX measure to get the Percentage Change from Month to Month. Problem is I do not have a traditional Dates table, my Dates table is more like a String table with Dates. 

 

Here is the visual i am trying to create:

-- The number of filings in here is a simple measure, and then I use a domension table to get the court names, and then i use my dates dimension (not really a dates table) to get the Year month

 

pfarahani_0-1626110623948.png

 

I want another column that has percentage change showing., but I cant use PREV MONTH syntax for the measure because my dates table is not marked Dates. 

 

What I did in my dates table, I created a Index, so that at least I can Rank my row to get the dates in order:

 

pfarahani_1-1626110777971.png

 Thanks

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@pfarahani , Try like this example , Date here us your Month year table

 

 

This Month = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[index]=max('Date'[index])))
Last Month = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[index]=max('Date'[index])-1))

 

diff = [This Month]-[Last Month]
diff % = divide([This Month]-[Last Month],[Last Month])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@pfarahani , Try like this example , Date here us your Month year table

 

 

This Month = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[index]=max('Date'[index])))
Last Month = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[index]=max('Date'[index])-1))

 

diff = [This Month]-[Last Month]
diff % = divide([This Month]-[Last Month],[Last Month])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak , worked out pretty nice i think, 1 small issue remains. Below is the chart, not bad, however my data ends with December 2019, but its still trying to calculate for the January 2020. Is their a solution using ISBLANK or an IF to stop after Dec 2019. thanks 

 

pfarahani_0-1626125281911.png

 

@amitchandak I think I got something here, 

I took the code you provided for diff% and modify to this:

diff % = IF( ISBLANK('_Measures Table'[This Month])
, BLANK(), DIVIDE([This Month]-[Last Month],[Last Month]))
 
Seems to work nice. One more question, the part i circled at the top, what is it calculating there? thanks
 
pfarahani_0-1626125841937.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.