The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
8 | |
8 |