Forum Discussion
Calculate Percentage Change from Previous Row
- 5 years ago
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])
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])
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
- pfarahani5 years agoHelper II
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