Search code examples
filterpowerbidaxbar-chartslicers

Filter / Slicer Modification (PowerBI)


I have sets of data from January to December, to be illustrated in a monthly bar chart. Is it possible to set a slicer that will show figures from January to selected month?

For example, if you click "August", the bar chart will show a bar from January to August instead of August alone.

Is it possible to set a slicer that will show figures from January to selected month?


Solution

  • It is possible. You will need a separate table for the month slicer.
    Add a new table similar to:

    Month MonthNum
    Jan 1
    Feb 2
    ... ...
    Nov 11
    Dec 12

    Then you can use a measure similar to:

    MyTotal = 
      var maxD = MAX('Month'[MonthNum]) // 'Month' is the name of the new table
      RETURN IF( MONTH(MAX('DimDate'[Date])) <= maxD, [Total] )
    

    Then for your chart, use the Month from your date table as the X-Axis (and not the one from the new table above).

    enter image description here

    enter image description here