How to create a custom date period slicer Power BI?

77 Views Asked by At

I am trying to create a slicer that will allow me to filter based on custom date groupings of Last 7 days, Last 30 days, Last 60 days, etc.. I found the below logic in another thread which seems to be exactly what I need. However when I see the results the dates do not correspond with the output I am expecting (see screenshot). For example I am showing 2/1/2024 showing up in the Last 7 days and last 30 days. I created a calculated table with this logic and linked it to a calendar table in my dashboard. I also tested the logic using single and bi-directional cross filter and nothing is working. Any help you can provide is greatly appreciated.

enter image description here

Date Periods = 
UNION(
    ADDCOLUMNS(
        CALENDAR(TODAY() - 7, TODAY()),
        "Period", "Last 7 days",
        "Sort", 1
    ),
    ADDCOLUMNS(
        CALENDAR(TODAY() - 30, TODAY()),
        "Period", "Last 30 days",
        "Sort", 2
    ),
    ADDCOLUMNS(
        CALENDAR(TODAY() - 60, TODAY()),
        "Period", "Last 60 days",
        "Sort", 3
    )
)

I created a calculated table with this logic and linked it to a calendar table in my dashboard. I also tested the logic using single and bi-directional cross filter and nothing is working.

1

There are 1 best solutions below

2
Sam Nseir On

Ensure your Date column is set to Data type Date and not DateTime.