The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
test measure = SWITCH(TRUE() ,"9.9" >= "10.5" , "#00AA00" ,"9.9" < "9.5","#FF1E00", "#BFA416" )
For the above dax it will return #00AA00 which is not same as per number comparison .How power bi compare text values?
Solved! Go to Solution.
Hi @Anonymous,
In Power BI, it will compare one by one starting from the first character of the string.
For example, "9.9" vs "10.5", Power BI judges that they are strings. And the first character "9" of "9.9" is larger than the first character "1" of "10.5", so "9.9">"10.5" is true.
Best regards
Icey
If this post helps, then consider Accepting it as the solution to help other members find it faster.
Hi @Anonymous,
In Power BI, it will compare one by one starting from the first character of the string.
For example, "9.9" vs "10.5", Power BI judges that they are strings. And the first character "9" of "9.9" is larger than the first character "1" of "10.5", so "9.9">"10.5" is true.
Best regards
Icey
If this post helps, then consider Accepting it as the solution to help other members find it faster.
@Anonymous , In double quote, it will be a string. Try like
test measure = SWITCH(TRUE() ,9.9 >= 10.5 , "#00AA00" ,9.9 < 9.5,"#FF1E00", "#BFA416" )
@Anonymous
maybe you can try this
test measure = SWITCH(TRUE() ,VALUE("9.9") >= value("10.5") , "#00AA00" ,value("9.9" )< value("9.5"),"#FF1E00", "#BFA416" )
Proud to be a Super User!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
77 | |
70 | |
48 | |
41 |
User | Count |
---|---|
140 | |
112 | |
72 | |
64 | |
63 |