Forum Discussion
Conditional color chart based on value
- 11 months ago
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.
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).