Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
HI I have a table with column as Color as below:
Color
Red
Green
Yellow
Pink
What I need is to create a measure like this:
Color Measure
Red 1
green 2
Yellow 3
Pink 4
I hope this is simple and can be easily done, I am trying if else but unable to get the result.
Thanks
Solved! Go to Solution.
Hi @Anonymous,
You can create a measure with If() function or Switch() function, see:
Measure(IF) = IF(MAX('Table3'[Color])="Red",1,IF(MAX('Table3'[Color])="green",2,IF(MAX('Table3'[Color])="Yellow",3,IF(MAX('Table3'[Color])="Pink",4,BLANK()))))
Measure(Switch) = SWITCH(TRUE(),MAX('Table3'[Color])="Red",1,MAX('Table3'[Color])="green",2,MAX('Table3'[Color])="Yellow",3,MAX('Table3'[Color])="Pink",4,BLANK())
Best Regards,
Qiuyun Yu
Hi @Anonymous,
You can create a measure with If() function or Switch() function, see:
Measure(IF) = IF(MAX('Table3'[Color])="Red",1,IF(MAX('Table3'[Color])="green",2,IF(MAX('Table3'[Color])="Yellow",3,IF(MAX('Table3'[Color])="Pink",4,BLANK()))))
Measure(Switch) = SWITCH(TRUE(),MAX('Table3'[Color])="Red",1,MAX('Table3'[Color])="green",2,MAX('Table3'[Color])="Yellow",3,MAX('Table3'[Color])="Pink",4,BLANK())
Best Regards,
Qiuyun Yu
Hi, i´m new with P.BI, i used your formula for my problem and it worked, but i don´t understand why you use MAX with text values, ¿Could you explain it?
thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |