Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
ShaneHi
Frequent Visitor

Date Filters within a Date Parameter

Hi,

 

My aim is to have a Slicer that will change a data table to show "Last 7 Days", "Last 10 Weeks", "Last 12 Months" or "Custom Date Range" (as an example).

 

I've built out a slicer using this guide, to build a Date Parameter table that pulls specific columns from my Calendar Table. I then dropped this said code into the column field of a Matrix table, and it works perfectly (e.g. When I select D, it shows my data in the matrix in Days, When I select W, it shows my data in the matrix as Weeks etc).

 

I'd just like to be able to have a bit of a filter on the date ranges, but I can't figure out how!

 

The code i'm using within my Parameter is:

 

 

 

Date Parameter (MoM Pages) = {
    ("D", NAMEOF('Calendar'[Date]), 0),
    ("W", NAMEOF('Calendar'[W/C Monday]), 1),
    ("M", NAMEOF('Calendar'[Month]), 2)
}

 

 

Is it even possible to filter the date range here?

 

Thanks

5 REPLIES 5
Anonymous
Not applicable

Hi @ShaneHi 

Please refer to the following post:
Power BI - Custom Date Range Filter Support - Microsoft Fabric Community

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

 

 

 

_AAndrade
Super User
Super User

Hi @ShaneHi,

Please take a look at this post: https://community.fabric.microsoft.com/t5/Desktop/Last-month-last-week-last-n-days-buttons-filters/m...

See if my solution could help you.





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




johnt75
Super User
Super User

You could create a table similar to the below

Date Range Table =
SELECTCOLUMNS (
    UNION (
        GENERATE (
            { "Last 7 Days" },
            DATESBETWEEN ( 'Date'[Date], TODAY () - 7, TODAY () )
        ),
        GENERATE (
            { "Last 10 Weeks" },
            DATESBETWEEN ( 'Date'[Date], TODAY () - 70, TODAY () )
        ),
        GENERATE (
            { "Last 12 Months" },
            DATESBETWEEN ( 'Date'[Date], EOMONTH ( TODAY (), -13 ) + 1, TODAY () )
        )
    ),
    "Date Range", [Value],
    'Date',
    'Date'[Date]
)

You may want to tweak the start and end dates if you want full weeks, or if you want the latest date to be yesterday.

Create a single direction many-to-many relationship with the Date table so that the 'Date Range Table' filters the date table and not the other way around.

You can now use the date range column in visuals and it will filter the date table accordingly.

This wouldn't work for a custom date range, but you could probably add an entry of { "Custom", BLANK() } into the union and then set up a normal slicer on the date table to achieve that.

SamWiseOwl
Super User
Super User

Hi @ShaneHi 

When you create a date slicer does it not filter your list of dates?


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

@ShaneHi 

Assuming you don't want to filter the data but rather remove the rows you could create a new column.

Create a new column in your calendar table something like this:
FDate =
If( [Date] >= date(year(today()), 01,01), [Date], blank())

 

Then add a row to your slicer table

Date Parameter (MoM Pages) = {
    ("D", NAMEOF('Calendar'[Date]), 0),
    ("FD", NAMEOF('Calendar'[FDate]), 1),
    ("W", NAMEOF('Calendar'[W/C Monday]), 2),
    ("M", NAMEOF('Calendar'[Month]), 3)
}

If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors