Forum Discussion

aj1107's avatar
aj1107
Advocate I
9 years ago
Solved

Last N month based slicer selection

I need to show the prior 3-month data count when selecting a date in the slicer. Created date table and related with txn table.   I can get the expected result if pass the slicer selected value as ...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi aj1107,

     

    You can refer to below steps to build a last N month slicer.

     

    1. Add column to convert dt to date.

    Date = DATEVALUE([dt]&"/2017") 

     

     

    2. Use above date column to create a slicer table.

    Selector Table2 = ADDCOLUMNS(VALUES(Test[Date]),"Month",FORMAT([Date],"mmmm"))

     

     

    3. Add measure to get selected date.

    Select = IF(HASONEVALUE('Selector Table2'[Date]),VALUES('Selector Table2'[Date]),BLANK()) 

     

    4. Write measure to count id and and filter records.

    Count ID = IF(MAX([Date])<[select],COUNT(Test[id]),BLANK())

     

    5. Create visuals.

     

    Regards,

    Xiaoxin Sheng