Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Auto select previous months

Hi guys,

 

I want to know if it is possible select one month, and the others selected automatically, like a MTD (I suppose). I have an alternative, using quarters checkbox, but, what i really want is select one month from the list.

 

Example: I choose the August month, and automatically select all previous months (Jan, fev, mar, apr, mai, jun, jul from 2015 and 2016).

 

What happens when i choose August:

 

What happens.

 

 

What i want:

 

what i want

 

I know the time slicer app, but i really don't like this app.

  • Anonymous

     

    Try this:

     

    Create a table with Months (1....12) Use this as Slicer. Don't related with your data table.

     

    Create a Measure: 

     

    ValuesChart =
    VAR MAXMONTH =
        VALUES ( Months[Month] )
    RETURN
        IF (
            VALUES ( Table1[Month] ) <= MAXMONTH,
            CALCULATE ( SUM ( Table1[Values] ) ),
            BLANK ()
        )

    Use this measure in your chart.

     

12 Replies

    • tnolan's avatar
      tnolan
      Frequent Visitor

      I dont know of a way to dynamically default slicers. I am sure this is a feature that is coming. You can statically default slicers by selecting the months you want then saving. When you or someone else views the report, then those months that were highlighted when you saved will be the default selection on the filters. 

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    Anonymous

     

    Try this:

     

    Create a table with Months (1....12) Use this as Slicer. Don't related with your data table.

     

    Create a Measure: 

     

    ValuesChart =
    VAR MAXMONTH =
        VALUES ( Months[Month] )
    RETURN
        IF (
            VALUES ( Table1[Month] ) <= MAXMONTH,
            CALCULATE ( SUM ( Table1[Values] ) ),
            BLANK ()
        )

    Use this measure in your chart.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Vvelarde,

       

      I tried your solution but I'm with some doubts.

       

      I created a table with a Month column (1,2,3,4...,12)

       

       

      Then I create a measure, but I've doubts what is the table/column that I need to put in "CALCULATE ( SUM...)"

       

      ValuesChart =
      VAR MAXMONTH =
          VALUES ( Dimensão Data[Month] )
      RETURN
          IF (
              VALUES ( Tabela1[Month] ) <= MAXMONTH,
              CALCULATE ( SUM ( Tabela1[Month] ) ),
              BLANK ()
          )

      I've already a Table with a date, year, month.. but I didn't related them.

       

       

      I have my Month slicer from my Tabela1 data

       

      What is the chart configuration?

       

       

      Thanks in advance,

      Flávio.

      • Vvelarde's avatar
        Vvelarde
        Community Champion

        Anonymous

         

        hi, you have 

         

        ValuesChart =
        VAR MAXMONTH =
            VALUES ( Tabela1[Month] )
        RETURN
            IF (
                VALUES ( DimensaoData[Month] ) <= MAXMONTH,
                ***YOUR COLUMN TO SHOW AS VALUE IN THE CHART***),
                BLANK ()
            )

         

        In the chart Use DimensaoData for Axis and Legend.

         

        Note: In you your DimensaoData the months are numeric. (1...12). If you don't have please add this column