Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Date Restriction for slicer

Hi Users,   I'm learning power bi. I would like to restrict the slicer as below and the visuals should interactive. Please help in achive this.    Thanks,.
  • v-robertq-msft's avatar
    5 years ago

    Hi, Anonymous 

    According to your description, you want to create a Slicer which contains dates between today() to today()-30, and use the Slicer to interact with other visuals, you can follow my steps:

    1. Create a calculated table:
    Date =
    
    var _Calendar=CALENDAR(DATE(2020,1,1),DATE(2020,12,31))
    
    var _today=FILTER(_Calendar,[Date]>=TODAY()-30&&[Date]<=TODAY())
    
    return _today

     

    1. Create a connection between the ‘Date’ table and your main table, like this(This is my test data):

     

    1. Create a Slicer, place ‘Date’[Date] into the Silcer, like this:

     

     

    And you can get what you want.

    You can download my test pbix file here

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

     

    Best Regards,

    Community Support Team _Robert Qin

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.