Forum Discussion
Anonymous
6 years agoNot applicable
New value for same dimension on another row.
Hi all, I want to make a calculation. It doesn't matter to do it with Dax or M. I have a dataset like as below. I have a customers. Our customers segment might change month by month. Segmen...
- 6 years ago
Hi Anonymous
for DAX
Final_Segment = SWITCH(TRUE(), [04.2020] = 1 && [05.2020] = 1, [New_Segment], [04.2020] = 0 && [05.2020] = 1, CALCULATE(FIRSTNONBLANK(Table[New_Segment], 1), ALLEXCEPT(Table, Table[Customer]), Table[04.2020] = 1, [04.2020] = 1 && [05.2020] = 0, 0 ) - 6 years ago
Hi Anonymous
I would value az38's answer, but a little change below:
Final_Segment = SWITCH(TRUE(), [04.2020] = 1 && [05.2020] = 1, FORMAT([New_Segment],"general"), [04.2020] = 0 && [05.2020] = 1, CALCULATE(FIRSTNONBLANK('Table'[New_Segment], 1), FILTER(ALLEXCEPT('Table', 'Table'[Customer]), 'Table'[04.2020] = 1)), [04.2020] = 1 && [05.2020] = 0, "0" )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
az38
Community Champion
6 years agoHi Anonymous
for DAX
Final_Segment =
SWITCH(TRUE(),
[04.2020] = 1 && [05.2020] = 1, [New_Segment],
[04.2020] = 0 && [05.2020] = 1, CALCULATE(FIRSTNONBLANK(Table[New_Segment], 1), ALLEXCEPT(Table, Table[Customer]), Table[04.2020] = 1,
[04.2020] = 1 && [05.2020] = 0, 0
)