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.
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!