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 simple table (Table1) and I'm trying to make a measure (Measure1) which prints text from two columns (Name1, Name2) depending the value in "Value" -column.
If "Value"=0, print Name2.
How do I do this measure?
Table1
Name1 | Name2 | Value | Measure1 (If Value = 0, print Name2) |
Smith | Beaner | 0 | Beaner |
Simonson | Bee | 1 | Simonson |
Adams | Beck | 0 | Beck |
Thanks.
Solved! Go to Solution.
To only give the solution would be easy so im also trying to explain how IF statements work in PBI Measures.
This is your solution.
Measure = IF(SELECTEDVALUE(Table1[Value])=0;SELECTEDVALUE(Table1[Name2]);SELECTEDVALUE(Table1[Name1]))
To simplify an if statement its basically this:
IF(Logic;Iflogicistrue;iflogicisfalse)
But a measure allways needs some form ¨Group" unlike columns. Where in a calculated column you can refer to another column by just refering in a measure you need MAX() MIN() or in this case i used SELECTEDVALUE().
Then i selected the column with the value and checked if it was 0. If it was i would use name2. If it wasent i would use name1.
If you would like to expand this statement it would look something like this:
Measure = IF(Selectedvalue(Value)=0;Name2;IF(Selectedvalue(value)=1;name1;Othervalue))
I hope this makes sense! Goodluck
If this post helped please consider marking it as a solution.
Quality over Quantity
Great! The column was the reason! 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 |
---|---|
117 | |
104 | |
77 | |
73 | |
52 |
User | Count |
---|---|
145 | |
109 | |
108 | |
90 | |
64 |