Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Good morning,
In a table, I use concatenation to group 3 values in the same cell.
I would like to be able to change the color of just one of the 3 values based on it.
How to do ?
Thanks in advance.
Mathieu
DAX:
Solved! Go to Solution.
Use Tabulator PowerBI Visual
You can use this table in your report and just create a HTML measure like i have sent above. This is working fine,
can you please share your measure code here
Here is what I did to test :
Assuming you want to change the color of the value from [DeltaSat (Agent)] based on a condition, you can use the following DAX code:
DeltaSat (Formatage) =
VAR AgentColor = IF([DeltaSat (Agent)] < 0.2, "Red", "Black") -- Define your condition here
VAR AgentText = FORMAT([DeltaSat (Agent)], "Percent")
VAR EquipeText = FORMAT([DeltaSat (Equipe)], "Percent")
VAR CompétenceText = FORMAT([DeltaSat (Compétence)], "Percent")
RETURN
SWITCH(
TRUE(),
[DeltaSat (Agent)] < 0.2, "<span style='color:" & AgentColor & "'>" & AgentText & "</span> | " & EquipeText & " | " & CompétenceText,
TRUE(), AgentText & " | " & EquipeText & " | " & CompétenceText
)
In this code, we first define a variable AgentColor that checks a condition for [DeltaSat (Agent)] and sets the color to "Red" if the condition is met, otherwise "Black". You can change the condition as per your requirement.
Then, we use the SWITCH function to conditionally format the text in the DeltaSat (Formatage) column. If the condition is met, it wraps the [DeltaSat (Agent)] value in an HTML span element with the specified color.
Make sure you replace the condition in IF with your specific criteria for changing the color, and adjust the color and formatting as needed. This code assumes that you are working with a table that can interpret HTML styling for text color.
Hello @_elbpower
Thanks for your return.
Are you sure the HTML code works in DAX, I tested it, but without success?
Mathieu
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
19 | |
17 | |
12 | |
9 | |
9 |