Forum Discussion
Anonymous
3 years agoNot applicable
population stability index - DAX
I need to compare a first year month of my distribuition with another year-month distribuition as well , in this example i need to compare 2020-05 with 2020-06,2020-07 and 2020-08.. and so on.. ...
- 3 years ago
Hi, Anonymous
You can try the following methods.
Sample data:
Measure:
Previous quantity = Var _Previous_month=MAXX(FILTER(ALLEXCEPT('Table','Table'[value_variable]),[year_month]<SELECTEDVALUE('Table'[year_month])),[year_month]) Return CALCULATE(SUM('Table'[quantity]),FILTER(ALLEXCEPT('Table','Table'[value_variable]),[year_month]=_Previous_month))Result = Var _Currentquantity=SUM('Table'[quantity]) return IF(ISBLANK(_Currentquantity) || ISBLANK([Previous quantity]),BLANK(), SUMX('Table',_Currentquantity-[Previous quantity])*LN(_Currentquantity/[Previous quantity]))Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-zhangti
Community Support
3 years agoHi, Anonymous
You can try the following methods.
Sample data:
Measure:
Previous quantity =
Var _Previous_month=MAXX(FILTER(ALLEXCEPT('Table','Table'[value_variable]),[year_month]<SELECTEDVALUE('Table'[year_month])),[year_month])
Return
CALCULATE(SUM('Table'[quantity]),FILTER(ALLEXCEPT('Table','Table'[value_variable]),[year_month]=_Previous_month))Result =
Var _Currentquantity=SUM('Table'[quantity])
return
IF(ISBLANK(_Currentquantity) || ISBLANK([Previous quantity]),BLANK(),
SUMX('Table',_Currentquantity-[Previous quantity])*LN(_Currentquantity/[Previous quantity]))
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.