Forum Discussion

PowerBI-Newbie's avatar
2 years ago
Solved

Parameter slider to remove bars higher than selected value

Hi,

I have a clustered column chart and I added a parameter slider to the Y-Axis (see image below):

 

What I want to achieve is when the user changes the slider/value and thus the Y-Axis maximum value, the bars that are more than the selected value should not appear on the graph and the ones that are equal to or less than the selected value should remain. How can I achieve this?

  • Hi PowerBI-Newbie 
    Create a measure that says:
    Show or Hide measure =
    If( [SrStatusCalculation] > SelectedValue(table[srStatusSliderMax]), BLANK(), [SrStatusCalculation] )
    Use BLANK if you want the column to disappear or 0 to keep the column but show empty.

  • SamWiseOwl's avatar
    SamWiseOwl
    2 years ago

    Hi PowerBI-Newbie 

    Oh that is awesome, I will be making more videos but got side tracked by having children 😂

     

    The measure will effectively replace the Y axis calculation, so something like this:
    If( COUNT(Issues[Incident Date]) > [MaxChart All Faults Count - All], BLANK(), COUNT(Issues[Incident Date]) )

     

    Let me know how you get on 🙂

    Also if you didn't know we have full free video courses you can watch!

12 Replies

  • Hi PowerBI-Newbie 
    Create a measure that says:
    Show or Hide measure =
    If( [SrStatusCalculation] > SelectedValue(table[srStatusSliderMax]), BLANK(), [SrStatusCalculation] )
    Use BLANK if you want the column to disappear or 0 to keep the column but show empty.

    • PowerBI-Newbie's avatar
      PowerBI-Newbie
      Icon for Helper IV rankHelper IV

      Hi SamWiseOwl ,

      It was actually your video that I was watching and you're the one that responds to my message!

      Where do I put the new measure? The graph and details of the measures/columns that I'm using are as follows:

       

      X-Axis is a column from my date table.

      Legend is a column from my Issues table.

      Y-Axis is a measure:

      All Faults Count - All = COUNT(Issues[Incident Date])+0

      Y-Axis max is a measure from the parameter:

      MaxChart All Faults Count - All = 
      CALCULATE(
          MAXX(
              ADDCOLUMNS(DISTINCT(ALL(Issues[Year:Period],Issues[Status])),"AllCount",[All Faults Count - All]),[AllCount])*1.1,
              All(Issues)
      )

       

      I gave the above details to give you a bit more detail and for me to know where the new measure will slot in.

      • SamWiseOwl's avatar
        SamWiseOwl
        Icon for Super User rankSuper User

        Hi PowerBI-Newbie 

        Oh that is awesome, I will be making more videos but got side tracked by having children 😂

         

        The measure will effectively replace the Y axis calculation, so something like this:
        If( COUNT(Issues[Incident Date]) > [MaxChart All Faults Count - All], BLANK(), COUNT(Issues[Incident Date]) )

         

        Let me know how you get on 🙂

        Also if you didn't know we have full free video courses you can watch!

  • Hi SamWiseOwl ,

    Sorry to bother you. How do I take the user selection of certain columns into account? So still using the following measures:

    Y-Axis Maximum:

    All Faults Count - All Status Y-Axis = IF( ([All Faults Count - All]) > [MaxStatusSlider Value], 0, ([All Faults Count - All] ))

     

    MaxStatusSlider Value (Parameter measure):

    MaxStatusSlider Value = SELECTEDVALUE('MaxStatusSlider'[MaxStatusSlider], [MaxChart Overall Failure Status All Faults Count - All])

     

    Fault Count Measure:

    MaxChart All Faults Count - All = 
    CALCULATE(
        MAXX(
            ADDCOLUMNS(DISTINCT(ALL(Issues[Year:Period],Issues[Status])),"AllCount",[All Faults Count - All]),[AllCount])*1.1,
            All(Issues)
    )

     

    So the user may select a particular date period or filter by category so what do I need to change within the measure(s) above to ensure the Y-Axis measure updates accordingly?

    • SamWiseOwl's avatar
      SamWiseOwl
      Icon for Super User rankSuper User

      Hi PowerBI-Newbie the only thing I see that would be preventing it from changing is the ALL.

      All removes internal AND external filters.

      AllSelected only removes internal ones (external filters like slicers, filter pane, drillthrough will be kept).

      Or AllExcept to remove all filters except the ones on columns you specify.