Forum Discussion
SUMESHKUMAR22
Helper IV
4 years agoCalculation the previous value for % change based on date slicer selection
Hi Team, In a page , I’m having a date range between slicer and showing card e.g. total sales which is simple sum aggregation. scenario needed : I want to create a %change card with indicator 🔺(g...
- Anonymous4 years ago
Hi SUMESHKUMAR22 ,
I have built a data sample
Please try the following formula to create a measure:
% change formula = var _curr=CALCULATE(SUM('Table'[Values]),DATESBETWEEN('Table'[Date],MIN('Table'[Date]),MAX('Table'[Date]))) var _diff=DATEDIFF(MIN('Table'[Date]),MAX('Table'[Date]),DAY) var _pre=CALCULATE(SUM('Table'[Values]), DATESBETWEEN('Table'[Date],MIN('Table'[Date])-_diff,MIN('Table'[Date]))) return (_curr - _pre)/_preThen format the measure:
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - 4 years ago
Hi,
Share some data to work with.
- 4 years ago
Anonymous
4 years agoNot applicable
Hi SUMESHKUMAR22 ,
I have built a data sample
Please try the following formula to create a measure:
% change formula =
var _curr=CALCULATE(SUM('Table'[Values]),DATESBETWEEN('Table'[Date],MIN('Table'[Date]),MAX('Table'[Date])))
var _diff=DATEDIFF(MIN('Table'[Date]),MAX('Table'[Date]),DAY)
var _pre=CALCULATE(SUM('Table'[Values]), DATESBETWEEN('Table'[Date],MIN('Table'[Date])-_diff,MIN('Table'[Date])))
return (_curr - _pre)/_pre
Then format the measure:
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SUMESHKUMAR22
Helper IV
4 years agoHi,
Thanks! Anonymous for the solution . I also approched the same method 🙂