Forum Discussion

cham's avatar
cham
Post Patron
7 years ago
Solved

Slicer

Hi,

 

Once I select the date in slicer, I need to change the data in the table and pie chart which are not equal to that selected date and also I need to avoid the data from future dates.

 

When I select the specific date in slicer all my other charts need to show the data which are previous to that specific date. 

Ex- If we select 12/09/2018, I need to get 15/8/2018, 4/9/2018, 9/9/2018 data shown in my table and pie chart. (I dont want to capture the data from the date which I selected and the date which are in future.)

 

 

  • So i can not find a "Smart" way to do this.

    Maybe someone who understands M coding can, or there is a smart trick some where.

     

    But here is a way you can do it.

     

    You will need two filters, one for the date, and one for the date in an ascending index.

     

    First use to RANKX

    Here is my formula

    Index = RANKX(
    ALL(Table);
    RANKX(ALL(Table);Table[Last Contact];;ASC)
    )
    This will make sure the latest date, has the lowest number.
     
    First filter date as everything before. (In my case everything before 15-10-2015).
    Then select everything and the remove the lowest number on the index. (This will remove the current day.)
     
    As you can see i have all dates chosen from the first filter except the 15-10-2017, as this was index 17.


    Hope this will help, but yea. not a nice looking way to do it.
     

3 Replies

  • Thim's avatar
    Thim
    Resolver V

    So i can not find a "Smart" way to do this.

    Maybe someone who understands M coding can, or there is a smart trick some where.

     

    But here is a way you can do it.

     

    You will need two filters, one for the date, and one for the date in an ascending index.

     

    First use to RANKX

    Here is my formula

    Index = RANKX(
    ALL(Table);
    RANKX(ALL(Table);Table[Last Contact];;ASC)
    )
    This will make sure the latest date, has the lowest number.
     
    First filter date as everything before. (In my case everything before 15-10-2015).
    Then select everything and the remove the lowest number on the index. (This will remove the current day.)
     
    As you can see i have all dates chosen from the first filter except the 15-10-2017, as this was index 17.


    Hope this will help, but yea. not a nice looking way to do it.
     
    • AlB's avatar
      AlB
      Community Champion

      Hi Thim

      Have you tried to modify the code that is generating the data for your chart as in:

       

      CALCULATE (
          [Measure/code generating data for your chart];
          FILTER (
              ALL ( TableName[Last contact] );
              TableName[Last contact] <= MAX ( TableName[Last contact] )
          )
      )