Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
I'm trying to create a new measure that will return 1 or 0 based on the value of a column, so that I can then use that measure to do some conditional formatting on tables fields. Here's what I have for the new measure currently:
Idea is, the column should show a red background if the db student_record'[letter_grade] field is anything but the values listed in the SWITCH statement. What seems to be happening though is only a value of "P" is showing the white background - all others listed in the SWITCH statement - and any other value - is showing in red.
Hi again @tamerj1 - revisiting this as it's still not working. Wanted to provide some context with some screenshots to hopefully help.
So the thing is, that custom column and the conditional formatting is working for the table on the right. Because above, Cole's Working at Heights record with an "EX" isn't showing up as red. But the custom column and conditional formatting isn't working for the table on the left.
Any help, again, much appreciated.
Hi @lcharlebois ,
I have checked the formula, it works well.
Please refer to my pbix file.
If it is possible, please provide your pbix file without privacy information for us to study.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @lcharlebois
you need to check your source data for visible and invisible spaces and characters. You need to use power quert to trim and clean the data. This could be the issue or one of many.
Hi @tamerj1 - thanks for the quick reply.
I definitely considered that, and updated the values on some test records manually rather than through our Java app, with the same result.
I think SELECTEDVALUE returns blank for most of the rows as a result of finding many values. Please Try measure:
SELECTEDVALUE('db student_record'[letter_grade])
and see what results you receive.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 8 | |
| 7 | |
| 7 |