Forum Discussion
Ale
7 years agoResolver II
Column output based on another column value and time function
I have a table like that: I'm comparing values from CurrentMonth vs PreviousMonth (based on the month selected in the slicer) for all of the KPIs, and based on that, I assign a specific resu...
- 7 years ago
Ale Please try this as a "Measure"
Result = SWITCH(SELECTEDVALUE(Test155[KPIName]), "A",IF(_KeyMeasures[Test155CurrMonth]>=_KeyMeasures[Test155PrevMonth]*1.10,1,0), "B",IF(_KeyMeasures[Test155CurrMonth]>=_KeyMeasures[Test155PrevMonth]*1.03,1,0), "C",IF(_KeyMeasures[Test155CurrMonth]>=_KeyMeasures[Test155PrevMonth],1,0), 0)
PattemManohar
7 years agoCommunity Champion
Ale Please try this as a "Measure"
Result = SWITCH(SELECTEDVALUE(Test155[KPIName]),
"A",IF(_KeyMeasures[Test155CurrMonth]>=_KeyMeasures[Test155PrevMonth]*1.10,1,0),
"B",IF(_KeyMeasures[Test155CurrMonth]>=_KeyMeasures[Test155PrevMonth]*1.03,1,0),
"C",IF(_KeyMeasures[Test155CurrMonth]>=_KeyMeasures[Test155PrevMonth],1,0),
0)Ale
7 years agoResolver II
Uow, I was missing the SELECTEDVALUE thing. I never heard about that (I started with PowerBI last week).
Apparently it worked! I also found a second solution but it envolves creating multiple columns on the dataset (previousmonth column, previousmonthvalue column, and from there the result column). It's not that elegant tho. I will stick with your solution. Thank you so much!