Forum Discussion
Conditional color chart based on value
Hi All,
I need to build a chart which shows % of sales for a country.
I have India country and % of sales 14 % .These are direct columns.
Now I need a chart which shows a needle like below to show % of sales and should be color code also as red.
If its morethan 70 should be green .But the chart I am using doesnt have the conditional color code.(Tachometer chart)
Please suggst the chart to fit my requirement or the steps create the required chart
Hi viswaaa ,
Thanks for posting in Microsoft Fabric Community.
Thanks to Shahid12523 , alish_b and MohamedFowzan1 for your valuable suggestions.
I tested this scenario using a small table with Country and SalesPct values. For example, India = 14, USA = 72, UK = 45, Germany = 85. In the gauge visual, I placed SalesPct as the Value and fixed the axis from 0 to 100. With a country slicer applied, the colors update based on the classification.
To classify performance I used a measure such as:
Sales Performance = SWITCH ( TRUE(), MAX('Sales'[SalesPct]) >= 70, 1, // Good (Green) MAX('Sales'[SalesPct]) >= 50, 2, // Fair (Yellow) 3 // Poor (Red) )This allows you to define whether the percentage should be treated as red or green.
If this approach does not meet your exact need, you can consider custom visuals such as xViz Advanced Gauge or Dial Gauge, which have semantic formatting options to apply red or green automatically as suggested in the blog link already shared earlier by MohamedFowzan1
Hope this helps. Please reach out for further assistance.
Thank you.
Attached .pbix file for reference.
4 Replies
- alish_bSuper User
Hey viswaaa ,
If you are planning to show this kind of comparison for more than one country, bullet chart might be worth exploring. It will work for just one country as well but it really shines when you are dealing with multiple categories. Find a detailed documentation on bullet charts in Power BI here: https://www.sqlbi.com/articles/building-bullet-charts-in-power-bi-reports/
Hope it helps!
- v-veshwara-msftCommunity Support
Hi viswaaa ,
Thanks for posting in Microsoft Fabric Community.
Thanks to Shahid12523 , alish_b and MohamedFowzan1 for your valuable suggestions.
I tested this scenario using a small table with Country and SalesPct values. For example, India = 14, USA = 72, UK = 45, Germany = 85. In the gauge visual, I placed SalesPct as the Value and fixed the axis from 0 to 100. With a country slicer applied, the colors update based on the classification.
To classify performance I used a measure such as:
Sales Performance = SWITCH ( TRUE(), MAX('Sales'[SalesPct]) >= 70, 1, // Good (Green) MAX('Sales'[SalesPct]) >= 50, 2, // Fair (Yellow) 3 // Poor (Red) )This allows you to define whether the percentage should be treated as red or green.
If this approach does not meet your exact need, you can consider custom visuals such as xViz Advanced Gauge or Dial Gauge, which have semantic formatting options to apply red or green automatically as suggested in the blog link already shared earlier by MohamedFowzan1
Hope this helps. Please reach out for further assistance.
Thank you.
Attached .pbix file for reference. - Shahid12523Community Champion
Option 1: Use Power BI Gauge Chart
The built-in Gauge visual doesn’t have direct conditional color formatting, but you can achieve it like this:
Add your % of sales measure (e.g., Sales % = DIVIDE([Sales], [Total Sales])).
Place it in the Gauge Value.
In the Format pane → Data colors, Power BI won’t allow conditions directly, but you can:
Create another measure that sets thresholds:
GaugeColor =
IF([Sales %] < 0.7, "Red", "Green")
Use a custom visual (see below), because native gauge won’t let you bind GaugeColor.Option 2: Use Custom Visual (Bullet Chart / Tachometer Pro / Shielded Gauge)
Go to Power BI Visuals Marketplace (AppSource) and search:
“KPI Tachometer”
“Bullet Chart by OKViz”
“Dial Gauge”
“xViz Gauge”
Most of these allow conditional formatting (rule-based colors for ranges, e.g., 0–70 Red, 70–100 Green).
- MohamedFowzan1Super User