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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Filter Relative date

Hello,

 

I need to filter my visuals using Filter type `Relative date`  for the previous week. I want to set week as starting on Monday and ending on Sunday. Despite having set `Local for import` for Poland and having my Regional settings set to Poland and France, I still have Power BI filters saying that week starts on Sunday and ends on Saturday. I would be grateful for helping in this matter.

 

annar_1-1740740895777.png

 

annar_0-1740740547696.png

 

 

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Anonymous 

 

This is actually a long standing bug - https://community.fabric.microsoft.com/t5/Issues/There-is-a-bug-in-the-relative-date-slicer-incorrec... 

 

Alternatively, you can create a calculated column that returns a week number relative to today's date and use this calculated column to filter your visuals.

Week Number from Today = 
VAR PreviousSunday =
    VAR CurrentDate = TODAY ()  -- Get the current date
    VAR DayOfWeek = WEEKDAY ( CurrentDate, 2 ) -- Determine the day of the week (1 = Monday, 7 = Sunday)
    VAR Result =
        IF (
            DayOfWeek = 7,  
            -- If today is Sunday, return today
            CurrentDate,
            -- Otherwise, subtract the day of the week to get the last Sunday
            CurrentDate - DayOfWeek  
        )
    RETURN Result

VAR _DIFF =
    DATEDIFF ( CalendarTable[Date], PreviousSunday, DAY ) + 1 
    -- Calculate the difference in days between the given date and the last Sunday

VAR _ROUNDEDUP =
    ROUNDUP ( DIVIDE ( _DIFF, 7 ), 0 )  
    -- Convert the day difference into weeks, rounding up to the nearest whole number

RETURN
    IF ( _ROUNDEDUP >= 1, _ROUNDEDUP, 0 )  
    -- Ensure the result is at least 1; otherwise, return 0

danextian_0-1740742664171.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
danextian
Super User
Super User

Hi @Anonymous 

 

This is actually a long standing bug - https://community.fabric.microsoft.com/t5/Issues/There-is-a-bug-in-the-relative-date-slicer-incorrec... 

 

Alternatively, you can create a calculated column that returns a week number relative to today's date and use this calculated column to filter your visuals.

Week Number from Today = 
VAR PreviousSunday =
    VAR CurrentDate = TODAY ()  -- Get the current date
    VAR DayOfWeek = WEEKDAY ( CurrentDate, 2 ) -- Determine the day of the week (1 = Monday, 7 = Sunday)
    VAR Result =
        IF (
            DayOfWeek = 7,  
            -- If today is Sunday, return today
            CurrentDate,
            -- Otherwise, subtract the day of the week to get the last Sunday
            CurrentDate - DayOfWeek  
        )
    RETURN Result

VAR _DIFF =
    DATEDIFF ( CalendarTable[Date], PreviousSunday, DAY ) + 1 
    -- Calculate the difference in days between the given date and the last Sunday

VAR _ROUNDEDUP =
    ROUNDUP ( DIVIDE ( _DIFF, 7 ), 0 )  
    -- Convert the day difference into weeks, rounding up to the nearest whole number

RETURN
    IF ( _ROUNDEDUP >= 1, _ROUNDEDUP, 0 )  
    -- Ensure the result is at least 1; otherwise, return 0

danextian_0-1740742664171.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

Hello, thank you for an answer! 🙂

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors
Top Kudoed Authors