Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Control Range Date by Dropdown filter

Hi all,   I have a table calendar with data in each hour. I created a slicer for date between. I want to create a dropdown list which calculate today, last 7 days,... and when I choose one value,...
  • v-juanli-msft's avatar
    6 years ago

    Hi Anonymous 

    A workaround below:

    Create a date table

    date = CALENDAR(MIN('Table'[date]),TODAY())

    add a column

    slicer item =
    SWITCH (
        TRUE (),
        [Date]
            = TODAY (), "today",
        DATEDIFF (
            [Date],
            TODAY (),
            DAY
        ) <= 7
            && [Date]
                < TODAY (), "last 7 days",
        DATEDIFF (
            [Date],
            TODAY (),
            DAY
        ) <= 30
            && [Date]
                < TODAY (), "last 30 days"
    )
    

    Then edit interactions as below

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.