Home › Power BI › Power Query Language M Start of Week
Power BI · Jul 20, 2016

Power Query Language M Start of Week

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).

 

4 Responses to Power Query Language M Start of Week

  1. 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.

  2. i want to get current week start date so dateDate.StartOfWeek(,1) i used this but it is showing token literal expected

  3. 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/

Leave a Reply

Your email address will not be published. Required fields are marked *

Carl de Souza
KEEP LEARNING. KEEP BUILDING.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.