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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply

Help with Date.StartOfWeek / End

Hi everyone,

 

I need a little help to solve this: In Power Query, I have a calendar table with the dates of the year. 

Through the expressions Date.StartOfWeek([Data]) and Date.EndOfWeek([Data]) I know the start date and end date of each week (of the year?).

But this brings me a result that I cannot use, since in the week of 09/01/20, I want the beginning of the week of September to be considered 09/01/20 (tuesday) and not 08/30/20 (sunday). The same behavior I want for the end of the week. If the month ends on a Thursday, for example, I want that date to be considered.


Any suggestions?

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @LeandroCampacci ,

You can add an optional parameter in the function Date.StartofWeek() and Date.EndofWeek() to define the start / end day of each week:

= Table.AddColumn(#"Added Custom", "Start", each Date.StartOfWeek([Date],2))

= Table.AddColumn(#"Added Custom1", "End", each Date.EndOfWeek([Date],4))

st.pngebd.png

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yingjl
Community Support
Community Support

Hi @LeandroCampacci ,

You can add an optional parameter in the function Date.StartofWeek() and Date.EndofWeek() to define the start / end day of each week:

= Table.AddColumn(#"Added Custom", "Start", each Date.StartOfWeek([Date],2))

= Table.AddColumn(#"Added Custom1", "End", each Date.EndOfWeek([Date],4))

st.pngebd.png

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Oh "sheet", my fault. I used more than 50% of my brain now. 🤣

 

For the start of the week on currently month:

 

if [Semana do Mês] = 1
then Date.StartOfMonth([Data])
else Date.StartOfWeek([Data])

 

Now for the end of the week I don't know if the rule is the same, since the month can end in week 5, 6...

 

Maybe this?

 

if [Semana do Mês] = 5 or [Semana do Mês] = 6
then Date.EndOfMonth([Data])
else Date.EndOfWeek([Data])

have you answered your own question at 50%

what you can also do is get the max of the month i think and rather use that to get the week. But I would need sample data to help more.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




vanessafvg
Super User
Super User

can you please provide some sample data. When you say you want it to be considered, what demonstrates that its considered, can you show what calculations you are using. What are you expecting as an answer. Its not very clear.




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Sorry, @vanessafvg. See this GIF: https://imgur.com/0XdSDHb

 

On first Column show the first day of September Note that the week of the month ("semana do mês") column shows the value "1" for that row, representing the first week of September. But in the next column, beginning of the week ("inicio da semana"), the date is 08/30/20. I need to be 09/01/20.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.