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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
aashton
Helper V
Helper V

Filter for Last Monday through Sunday

Hello,

I want to add a filter to my report to allow the user to run the data for the last Monday through Sunday.  So if today is Wednesday the 6th, and the filter asks if they want to see the data for last week, they pick yes, and it runs from Monday the 27th - Sunday the 3rd.  How would I write the DAX for that?

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @aashton 

 

You mean to say that no matter what day of the week it is, you should just filter the data for the whole of the previous week.

There two tables in my pbix file, Table and Y/N tabel

 

Try this measure:

Measure =
VAR _YorN =
    SELECTEDVALUE( 'Y/N'[Y/N] )
VAR _todaynumber =
    WEEKDAY( TODAY(), 2 )
VAR _startday =
    TODAY() - _todaynumber - 6
VAR _enddate =
    TODAY() - _todaynumber
RETURN
    IF(
        _YorN = 1,
        IF(
            SELECTEDVALUE( 'Table'[Date] ) >= _startday
                && SELECTEDVALUE( 'Table'[Date] ) <= _enddate,
            1,
            0
        ),
        BLANK()
    )

 

Reslut :

vchenwuzmsft_0-1633915215725.png

 

I put my pbix file in the attachment you can reference.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

View solution in original post

2 REPLIES 2
v-chenwuz-msft
Community Support
Community Support

Hi @aashton 

 

You mean to say that no matter what day of the week it is, you should just filter the data for the whole of the previous week.

There two tables in my pbix file, Table and Y/N tabel

 

Try this measure:

Measure =
VAR _YorN =
    SELECTEDVALUE( 'Y/N'[Y/N] )
VAR _todaynumber =
    WEEKDAY( TODAY(), 2 )
VAR _startday =
    TODAY() - _todaynumber - 6
VAR _enddate =
    TODAY() - _todaynumber
RETURN
    IF(
        _YorN = 1,
        IF(
            SELECTEDVALUE( 'Table'[Date] ) >= _startday
                && SELECTEDVALUE( 'Table'[Date] ) <= _enddate,
            1,
            0
        ),
        BLANK()
    )

 

Reslut :

vchenwuzmsft_0-1633915215725.png

 

I put my pbix file in the attachment you can reference.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

AlexisOlson
Super User
Super User

Using relative date filtering gets close but, unfortunately, uses weeks starting on Sunday and ending Saturday.

AlexisOlson_0-1633549043649.png

 

To improve on this, it helps if you have a date table with a week offset column defined using weeks starting and ending on the days you choose.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.