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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
cplesner
Helper III
Helper III

How to set build-in Relative Date filter to use monday as first day of the week

So using the filter, the "Current" week should be from 05-02-2018 to 11-02-2018

 

Capture.PNG

1 ACCEPTED SOLUTION

11 REPLIES 11
Anonymous
Not applicable

I have an issue when data is exported to excel sheet, there is no gap between the from date to to date 

 

 

please find below screenshot 

from date to to date .jpg

 

Anonymous
Not applicable

I am using a date table with a field called "Date -1"  that I then use as my relative date filter. Here is the Date Table:

DateTable = 
VAR _minTableDate = MIN ('Basic Calendar'[Date])
VAR _maxTableDate = MAX ( 'Basic Calendar'[Date])
VAR _minDate = IF ( ISBLANK ( _minTableDate ), DATE ( 2018, 1, 1 ), _minTableDate )
VAR _maxDate = IF ( ISBLANK ( _maxTableDate ), DATE ( 2019, 12, 31 ), _maxTableDate )
RETURN
ADDCOLUMNS (
CALENDAR ( _minDate, _maxDate ),
"Year", YEAR ([Date]),
"Date -1", [Date]-1,<--------------------------------------------------------THIS ONE!
"Current Year", YEAR(TODAY()),
"HalfYear", IF ( MONTH ( [Date] ) <= 6, "1st Half", "2nd Half"),
"MonthNumber", MONTH ( [Date] ),
"Current Month", MONTH(TODAY()),
"YearMonthNumber", FORMAT ( [Date], "YYYY.MM" ),
"YearMonthName", FORMAT ( [Date], "YYYY. mmmm" ),
"MonthName", FORMAT ( [Date], "mmmm" ),
"WeekNum", WEEKNUM ( [Date], 2 ),
"CurrentWeek", WEEKNUM (today(), 2 ),
"LastDayofCurrentWeek", CALCULATE(MAX('Basic Calendar'[Date]),WEEKNUM('Basic Calendar'[Date], 2 ) =WEEKNUM(TODAY(),2)),
"DayNum", DAY( [Date] ),
"DayOfWeekNumber", WEEKDAY ( [Date], 2 ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"Current Quarter", "Q" & FORMAT(TODAY(), "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ),
"CurrentYearQuarter", FORMAT ( TODAY(), "YYYY" ) & "/Q" & FORMAT ( TODAY(), "Q" )
)

 

Although my page filter still appears "wrong" (Sunday-Saturday week) it seems to be adjusting my date table the way I want.

Wrong looking filterWrong looking filter

As one example, here is a card to show the reporting time frame:Title CardTitle Card

 

 

 

The measure for the card looks like this:

Weekly Dash Title =
"Reporting Timeframe | Week " & DateTable[SelectedWeek] & ": "
    & MIN ( DateTable[Date] ) & " - "
    & MAX ( DateTable[Date] )

So the filter appears to be filtering the date table to a Monday-Sunday week which is then appropriately "offsetting" all my other measures since they reference and are related to the date table. There is probably a better work around but this works for me for now. Hope this helps!

It's Disappointing that Microsoft still has not fixed this.
Above proposed solution is not ok if you use any other relative period slicer than week.

If the report consumer would, based on the above solution, ask for last month (calendar), your actualy filtered days would also be shifted forward by one day resulting in wrong date range being selected.

dramus
Continued Contributor
Continued Contributor

We generated our own Relative dates table. We have strange fiscal periods, and people wanted to do relative period timeframes. Our table has the following timeframes:

"TIMEFRAME"                   "SORTORDER"                   
"Today"                       "1"                           
"Yesterday"                   "2"                           
"Last Weekday"                "3"                           
"This Week"                   "4"                           
"Last Week"                   "5"                           
"Next Week"                   "5"                           
"This Period"                 "6"                           
"This Period, Last Year"      "7"                           
"Last Period"                 "8"                           
"This Year"                   "9"                           
"Last Year"                   "10"                          
"Week +2"                     "11"                          

We have a third field on the table that is the date field and join that to our Dates table. So for "This Week" timeframe we would have seven entries in the table.

v-yuezhe-msft
Employee
Employee

@cplesner,

Currently, it is not possible to change the start day of week in the relative date slicer, there is an idea about this issue, please vote it up.

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/20248087-relative-date-filter-wee...

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Lydia,
this vote is currently 5 years pending, has thousands of upvotes. This message here has about 20k views. 
When will Microsoft schedule this thing to solve?

Done 🙂

Care to share? 

HOW?

dramus
Continued Contributor
Continued Contributor

I can't think of a way to do this in Power BI without resorting to DAX or Power Query. There is no where to tell it that you want a Monday start week, not a Sunday.

dramus
Continued Contributor
Continued Contributor

The Power Query (M) finction Date.StartOfWeek() may be of use in figuring out your weeks. It allows you to state what day your week should atart and returns the start date for the week for the supplied Date.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.