Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
uscartjoy
Frequent Visitor

Power BI Parameter Field Dynamic Slicer and Custom Conditional Formatting Based on Dynamic Slicer

I have data that measures various Performance Indicators.  I created Parameter Fields to create slicers which will change my charts based on the Performance Indicator Chosen.  This is my chart which is working well with the dynamic slicers.  I have two dynamic slicers.  One is the timeframe selection.  The other is the Measure selection.

Timeframe SlicerTimeframe SlicerMeasure SlicerMeasure Slicer

Example Chart for a Single Line and Overall for FacilityExample Chart for a Single Line and Overall for Facility

I would like to be able to color the chart above similar to this one, which uses DAX to specify the color it should be based upon comparing the value to the target.  I currently have a measure for each Performance Indicator with the coloring needed for that particular Indicator.

Display Performance Indicators Based on TargetsDisplay Performance Indicators Based on Targets

Example DAX for Coloring of IndicatorExample DAX for Coloring of Indicator

This is working great, when you have static charts.  I want to color my dynamic charts using the appropriate targets, based upon the Performance Indicator or Measure selected.  Is there a way I can do this?

1 ACCEPTED SOLUTION
uscartjoy
Frequent Visitor

I was actually able to get the coloring to work by doing the following:

 
Selected Measure = maxx(FILTER('Measure Slicer Table', 'Measure Slicer Table'[Parameter Order] = SELECTEDVALUE('Measure Slicer Table'[Parameter Order])), 'Measure Slicer Table'[Parameter])
 
Then the following:
Selected Line Measure Color = Switch([Selected Measure],
    "AI %", SWITCH(TRUE(), [Asset Intensity Total (%)]>=AVERAGE('Targets Line Glidepath'[AI 100]), "#04B430", [Asset Intensity Total (%)]<AVERAGE('Targets Line Glidepath'[AI 100]), "#ff3300"),
    "Efficiency %", SWITCH(TRUE(), [Efficiency Total (%)]>=AVERAGE('Targets Line Glidepath'[Efficiency 100]), "#04B430", [Efficiency Total (%)]<AVERAGE('Targets Line Glidepath'[Efficiency 100]), "#ff3300"),
    "eUPS %", SWITCH(TRUE(), [Estimated Unplanned Stoppages Time Total (%)]>=AVERAGE('Targets Line Glidepath'[OPS 100]), "#ff3300", [Estimated Unplanned Stoppages Time Total (%)]<AVERAGE('Targets Line Glidepath'[OPS 100]), "#04B430"),
    "Breakdown %", SWITCH(TRUE(), [Breakdown Time Total (%)]>=AVERAGE('Targets Line Glidepath'[Breakdown]), "#ff3300", [Breakdown Time Total (%)]<AVERAGE('Targets Line Glidepath'[Breakdown]), "#04B430"),
    "Minor Stops %", SWITCH(TRUE(), [Minor Stop Time Total (%)]>=AVERAGE('Targets Line Glidepath'[MS]), "#ff3300", [Minor Stop Time Total (%)]<AVERAGE('Targets Line Glidepath'[MS]), "#04B430"))
 
However, it only works so far with the "week" timeframe view.  I need it to work with all.
 
Weeks are Working for all IndicatorsWeeks are Working for all Indicators

View solution in original post

2 REPLIES 2
uscartjoy
Frequent Visitor

I was actually able to get the coloring to work by doing the following:

 
Selected Measure = maxx(FILTER('Measure Slicer Table', 'Measure Slicer Table'[Parameter Order] = SELECTEDVALUE('Measure Slicer Table'[Parameter Order])), 'Measure Slicer Table'[Parameter])
 
Then the following:
Selected Line Measure Color = Switch([Selected Measure],
    "AI %", SWITCH(TRUE(), [Asset Intensity Total (%)]>=AVERAGE('Targets Line Glidepath'[AI 100]), "#04B430", [Asset Intensity Total (%)]<AVERAGE('Targets Line Glidepath'[AI 100]), "#ff3300"),
    "Efficiency %", SWITCH(TRUE(), [Efficiency Total (%)]>=AVERAGE('Targets Line Glidepath'[Efficiency 100]), "#04B430", [Efficiency Total (%)]<AVERAGE('Targets Line Glidepath'[Efficiency 100]), "#ff3300"),
    "eUPS %", SWITCH(TRUE(), [Estimated Unplanned Stoppages Time Total (%)]>=AVERAGE('Targets Line Glidepath'[OPS 100]), "#ff3300", [Estimated Unplanned Stoppages Time Total (%)]<AVERAGE('Targets Line Glidepath'[OPS 100]), "#04B430"),
    "Breakdown %", SWITCH(TRUE(), [Breakdown Time Total (%)]>=AVERAGE('Targets Line Glidepath'[Breakdown]), "#ff3300", [Breakdown Time Total (%)]<AVERAGE('Targets Line Glidepath'[Breakdown]), "#04B430"),
    "Minor Stops %", SWITCH(TRUE(), [Minor Stop Time Total (%)]>=AVERAGE('Targets Line Glidepath'[MS]), "#ff3300", [Minor Stop Time Total (%)]<AVERAGE('Targets Line Glidepath'[MS]), "#04B430"))
 
However, it only works so far with the "week" timeframe view.  I need it to work with all.
 
Weeks are Working for all IndicatorsWeeks are Working for all Indicators
uscartjoy
Frequent Visitor

To better display the current DAX information for the coloring, here is my DAX code:

 

Asset Intensity Color Line Glidepath = SWITCH(TRUE(), [Asset Intensity Total (%)]>=AVERAGE('Targets Line Glidepath'[AI 100]), "#04B430", [Asset Intensity Total (%)]<AVERAGE('Targets Line Glidepath'[AI 100]), "#ff3300")

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors