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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Help to filter Current week and next Week

I have dates column in a table.
How can i filter the current week
And next week.

Thanks in Advance..
Have a great day
1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Sorry for my late respond, we can adjust the formula as below.

Column = 
VAR next =
    TODAY () + 7
VAR yn =
    YEAR ( next )
VAR yt =
    YEAR ( TODAY () )
VAR weeknumt =
    WEEKNUM ( TODAY (),2 )
VAR weeknun =
    WEEKNUM ( next,2 )
VAR wek =
    WEEKNUM ( 'date'[Date],2 )
RETURN
    IF (
        OR (
            yn = YEAR ( 'date'[Date] )
                && weeknun = wek,
            yt = YEAR ( 'date'[Date] )
                && weeknumt = wek&& WEEKDAY('date'[Date],2)<=5
        ),
        "current week & next week",
        BLANK ()
    )

 

2.PNG

 

As the picture above, Sat and Sunday have been exculded for current week.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi, 

 

What if the next weeks are in the next year ? This formula doesn't seems to work correcly.. any help? 

Thanks! 

 

Formula I'm using : 

 

Date_Filter =
VAR next =
    TODAY () + 7
VAR yn =
    YEAR ( next )
VAR yt =
    YEAR ( TODAY () )
VAR weeknumt =
    WEEKNUM ( TODAY () )
VAR weeknun =
    WEEKNUM ( next )
VAR wek =
    WEEKNUM ( Dim_Calendar[Calendar Date] )
RETURN
    IF (
            yn = YEAR ( Dim_Calendar[Calendar Date] )
                && weeknun = wek ||
            yt = YEAR ( Dim_Calendar[Calendar Date] )
                && weeknumt = wek ||
            yt = YEAR ( Dim_Calendar[Calendar Date] )
                && WEEKNUM(TODAY() +14) = wek ||
            yt = YEAR ( Dim_Calendar[Calendar Date] )
                && WEEKNUM(TODAY() + 21) = wek ||
            yt = YEAR ( Dim_Calendar[Calendar Date] )
                && WEEKNUM(TODAY() +28)  = wek||
            yt = YEAR ( Dim_Calendar[Calendar Date] )
                && WEEKNUM(TODAY() +35)  = wek||
            yt = YEAR ( Dim_Calendar[Calendar Date] )
                && WEEKNUM(TODAY() +42)  = wek ,
        "current week & next weeks",
        BLANK ()
    )
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have created a sample for your reference, please check the pbix as attached.

Column = 
VAR next =
    TODAY () + 7
VAR yn =
    YEAR ( next )
VAR yt =
    YEAR ( TODAY () )
VAR weeknumt =
    WEEKNUM ( TODAY () )
VAR weeknun =
    WEEKNUM ( next )
VAR wek =
    WEEKNUM ( 'date'[Date] )
RETURN
    IF (
        OR (
            yn = YEAR ( 'date'[Date] )
                && weeknun = wek,
            yt = YEAR ( 'date'[Date] )
                && weeknumt = wek
        ),
        "current week & next week",
        BLANK ()
    )

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
amitchandak
Super User
Super User

First create a date table and join it with you fact

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

In your date table have week number.

You can create a formula lagging seven days and it should work

before 7 day = CALCULATE(sum(Sales[Sales Amount]),dateadd('Date'[date],-7,DAY)) 

 


Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@Anonymous Please create a calculated column as per below. If the week number is equivalent to current week number or week number one plus one then return true. you can use this column in filter.

Column = 
VAR _weeknum = WEEKNUM(TODAY())
RETURN IF(WEEKNUM('Table'[Date])=_weeknum||WEEKNUM('Table'[Date])= _weeknum+1,TRUE(),FALSE())

 

Anonymous
Not applicable

Thanks

 

Is there any option to filter only monday to friday in current week

i.e sunday and saturday to be excluded..

 

According to your query week is starting from sunday how to start from monday?

Hi @Anonymous ,

 

Sorry for my late respond, we can adjust the formula as below.

Column = 
VAR next =
    TODAY () + 7
VAR yn =
    YEAR ( next )
VAR yt =
    YEAR ( TODAY () )
VAR weeknumt =
    WEEKNUM ( TODAY (),2 )
VAR weeknun =
    WEEKNUM ( next,2 )
VAR wek =
    WEEKNUM ( 'date'[Date],2 )
RETURN
    IF (
        OR (
            yn = YEAR ( 'date'[Date] )
                && weeknun = wek,
            yt = YEAR ( 'date'[Date] )
                && weeknumt = wek&& WEEKDAY('date'[Date],2)<=5
        ),
        "current week & next week",
        BLANK ()
    )

 

2.PNG

 

As the picture above, Sat and Sunday have been exculded for current week.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.