Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am attempting to highlight names in a table as follows:
Solved! Go to Solution.
Hi @LYorkToenniges ,
Thanks for reaching out to the Microsoft fabric community forum.
The original issue was that names in a Power BI table needed to be highlighted only when certain conditions are met:
So instead of that, I used a direct color logic in DAX.
First, I created a new measure to apply color conditionally, not using the flag.
Here's the DAX I used:
NameColor =
VAR _BlueDay = SELECTEDVALUE('SampleData'[Blue Day])
VAR _AdjCommitment = SELECTEDVALUE('SampleData'[Adjusted Commitment])
VAR _PctCommitment = SELECTEDVALUE('SampleData'[% of Commitment])
VAR _AdjFloorAvg = SELECTEDVALUE('SampleData'[Adjusted Floor Average])
RETURN
IF(
_AdjCommitment > 0 &&
(
(_BlueDay = "Blue" && _PctCommitment < _AdjFloorAvg) ||
(_BlueDay = "Not Blue" && _PctCommitment < 1)
),
"Red",
"Black"
)
In Table visual, and applied conditional formatting on the Name column:
Right-click on "Name" in the visual - Conditional formatting - Font color
In the popup:
Format style: Field value
Apply to: Values only
Based on field: Select the NameColor measure
Once applied, this correctly highlighted only the names that matched the logic. In my case, only "Bob" was highlighted in red exactly as expected based on the values.
This approach worked perfectly without needing a separate 1/0 flag, and it respects the row context cleanly without any random highlights. Hope this helps!
Please find the attached pbix file for your reference.
If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.
Best Regards,
Tejaswi.
Community Support.
Hi @LYorkToenniges ,
Thanks for reaching out to the Microsoft fabric community forum.
The original issue was that names in a Power BI table needed to be highlighted only when certain conditions are met:
So instead of that, I used a direct color logic in DAX.
First, I created a new measure to apply color conditionally, not using the flag.
Here's the DAX I used:
NameColor =
VAR _BlueDay = SELECTEDVALUE('SampleData'[Blue Day])
VAR _AdjCommitment = SELECTEDVALUE('SampleData'[Adjusted Commitment])
VAR _PctCommitment = SELECTEDVALUE('SampleData'[% of Commitment])
VAR _AdjFloorAvg = SELECTEDVALUE('SampleData'[Adjusted Floor Average])
RETURN
IF(
_AdjCommitment > 0 &&
(
(_BlueDay = "Blue" && _PctCommitment < _AdjFloorAvg) ||
(_BlueDay = "Not Blue" && _PctCommitment < 1)
),
"Red",
"Black"
)
In Table visual, and applied conditional formatting on the Name column:
Right-click on "Name" in the visual - Conditional formatting - Font color
In the popup:
Format style: Field value
Apply to: Values only
Based on field: Select the NameColor measure
Once applied, this correctly highlighted only the names that matched the logic. In my case, only "Bob" was highlighted in red exactly as expected based on the values.
This approach worked perfectly without needing a separate 1/0 flag, and it respects the row context cleanly without any random highlights. Hope this helps!
Please find the attached pbix file for your reference.
If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.
Best Regards,
Tejaswi.
Community Support.
Thank you so much. I figured out a work around, but this is more susinct. The issue turned out to be the measure referenced. I needed to use calculate to control the filters. It was being evaluated line by line - which is not what it's designed for - so it was throwing up crazy results. I will incorporate aspects of this in my solution for sure. Thank you!
Hi @LYorkToenniges ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please Accept it as a solution so that other community members can find it easily.
Thank you,
Tejaswi.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
User | Count |
---|---|
84 | |
76 | |
74 | |
49 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |