March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi everyone,
I am trying to conditional format the clustered column chart by the value in each bar:
5% or More = Red
2% to 4% = Yellow
2% or Less = Green
I know I am having multiple measures in the chart, and is it possible to achieve this conditional formatting?
Or alternatively, is there a DAX formula that may be able to help with this?
Many thanks!
Solved! Go to Solution.
Hi @aprilysxxx ,
From your description, please try the following steps:
My Sample:
1.Please try code as below to Create a X-axis table.
X-axis =
DATATABLE(
" X axis",STRING,
"Order",INTEGER,
{
{"Average",1},
{"Clothing",2},
{"Food",3},
{"Furniture",4}
}
)
2. Use the following code to create a measure-Value_Measure.
Value_Measure =
SWITCH(MAX('X-axis'[ X axis]),
"Average",[_Average],
"Clothing",[_Clothing],
"Food",[_Food],
"Furniture",[_Furniture]
)
3.Select your visual object and do the following in the Visualizations pane.
Result is as below.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @aprilysxxx ,
From your description, please try the following steps:
My Sample:
1.Please try code as below to Create a X-axis table.
X-axis =
DATATABLE(
" X axis",STRING,
"Order",INTEGER,
{
{"Average",1},
{"Clothing",2},
{"Food",3},
{"Furniture",4}
}
)
2. Use the following code to create a measure-Value_Measure.
Value_Measure =
SWITCH(MAX('X-axis'[ X axis]),
"Average",[_Average],
"Clothing",[_Clothing],
"Food",[_Food],
"Furniture",[_Furniture]
)
3.Select your visual object and do the following in the Visualizations pane.
Result is as below.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yes, you can achieve conditional formatting in a clustered column chart with multiple measures using DAX expressions in Power BI. Here's a general approach you can follow:
Create a Calculated Column: Start by creating a calculated column that represents the conditions you want to format. In this case, you want to categorize the values into three groups - Red, Yellow, and Green.
Replace YourMeasure with the actual name of the measure you want to use for conditional formatting.
Apply Conditional Formatting: Once you have the calculated column, use it for conditional formatting in your clustered column chart.
Adjust Colors: After you've applied the conditional formatting, you can adjust the colors for each category.
Remember to replace YourMeasure with the actual measure you are using in your chart.
This approach assumes that you want to color the entire bar based on the conditions. If you want to color specific portions of the bar differently, you might need to explore more advanced techniques using custom visuals or a combination of measures.
Always make sure to adjust the expressions based on your specific data model and requirements.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Hi 123abc,
Thank you for the feedback, and I have tried to create a color-coding measure based on your previous reply. When I tried to drop the color-coding measure into the "Visualization" pane - "Data colors" card, I am not sure if I have that option available on my side, and can you please help me understand if I am interpreting your feedback correctly?
Thanks in advance.
The steps I provided were more tailored to Power BI rather than Excel. In Excel, you might not have the same direct option to assign colors to data points using a separate measure in the "Data colors" card.
For Excel, you can still achieve similar conditional formatting by using the following steps:
Create a Color Measure:
ColorMeasure =
SWITCH(
TRUE(),
[YourMeasure] >= 0.05, 1,
AND([YourMeasure] >= 0.02, [YourMeasure] < 0.05), 2,
[YourMeasure] <= 0.02, 3
)
This time, the measure returns numerical values (1, 2, or 3) instead of color names.
Apply Conditional Formatting in Excel:
This approach doesn't directly assign colors through a "Data colors" card in the "Visualization" pane but achieves similar results through conditional formatting directly on the data cells.
Remember to adjust the measure and conditions based on your actual data model and requirements. If you're using Power BI, the process may differ slightly, and you can utilize the "Data colors" card more effectively.
Hi 123abc,
I shared the screenshot of my working process in the reply above, and it is in Power BI. And can you please help me understand if there is a chance to achieve this in Power BI (instead of in Excel)?
Thanks for the reply.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
18 | |
16 | |
13 |