Forum Discussion

uscartjoy's avatar
uscartjoy
Frequent Visitor
3 years ago
Solved

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 SlicerMeasure Slicer

Example 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 Targets

Example 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?

  • 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 Indicators

2 Replies

  • uscartjoy's avatar
    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 Indicators
  • uscartjoy's avatar
    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")