There is a function called StartOfWeek that displays the start of the week in Power Query formula language.
Syntax: Date.StartOfWeek(<date>)
The week starts on Sunday and runs through to Saturday. To use Monday to Friday, you can add a day to it using the function Date.AddDays(<date>, 1).
THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL
This only works when there are no weekend dates to convert. Sunday will be lumped in with the next week. Instead, use Date.StartOfWeek([Date of Service],Day.Monday)) to set Monday as the start of the week.
Thank you sir. I consider this the correct answer.
i want to get current week start date so dateDate.StartOfWeek(,1) i used this but it is showing token literal expected
That makes sense Carlo. You’re one of the first people I see using the shorthand value.
I discovered the Day.Type (second argument of Date.DayOfWeek) is an enumeration. Meaning you can use either the long values (Day.Sunday) or the shorthand (0).
For example:
Argument Value
Day.Sunday 0
Day.Monday 1
Day.Tuesday 2
Day.Wednesday 3
Day.Thursday 4
Day.Friday 5
Day.Saturday 6
Pretty awesome! You can find which functions can make use of the Day.Type here: https://powerquery.how/day-type/