Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Relative date filter - workaround when using text field?

I have a calendar table and want to use the MonthYear data field in a bar chart (September 2020) so only the last 3 months show up.  I don't want to keep manually changing it every month so would like to use a relative date filter.  Problem is, the MonthYear datafield in my calendar table is a text field so relative date filter does not work.

 

The only date field in my calendar table is Date and that shows the days as well as the month and year which is not what I want.

 

Thoughts?

3 Replies

  • Anonymous , You can slicer like this and select default value

    Month Type = Switch( True(),
    eomonth(Date[Date],0) = eomonth(Today(),0) ,"Current Month" , //This Month
    eomonth(Date[Date],0) = eomonth(Today(),-1)  ,"Previous Month" , //last Month
    eomonth(Date[Date],0) = eomonth(Today(),1)  ,"Next Month" , //last Month
    [Month Year]
    )

     

    or

    Month Type = Switch( True(),
    eomonth(Date[Date],0) >= eomonth(Today(),-3)+1 && eomonth(Date[Date],0) <= eomonth(Today(),-0) ,"Last Three Month" ,
    [Month Year]
    )

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    You do have date column (date type) in calendar table, right?

    Then you should be able to use monthyear column as axis and add date column as Relative date filter.

    Did i miss something?

     

    Best Regards,

    Jay