Excel WEEKNUM equivalent Power Query M Function

Skip2MiLu

New Member
Joined
Aug 11, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hi Guys


Does anyone know if there is any M function for Power Query to return the equivalent Weeknum function as used in Excel (see below) that I can use to in a custom column expression in power query to return the week number of a corresponding date column.

You will notice that I would like the Power Query expression to use the the equivalent 22 return type in excel Weeknum, which I not sure is possible.
I have browsed Microsoft Power Query M Function list below and did not seem to find anything, but not sure if I missing something

1656332456231.png


1656340647922.png


1656340705728.png
 

Attachments

  • 1656332442238.png
    1656332442238.png
    27.1 KB · Views: 49

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Add a custom column and use the below function - [Column1] in the formula below contains the column in which the date number is stored

= Date.WeekOfYear([Column1],Day.Monday)
 
Upvote 0
Thanks I do not know how I missed that.
Do you know if there is a way to work backwards.
I. E. Is there a function to calculate the date of the Monday or Friday if I had a columns with a week number and year?
 
Upvote 0
Add a custom column and use the below function - [Column1] in the formula below contains the column in which the date number is stored

= Date.WeekOfYear([Column1],Day.Monday)
Thanks for the function. But I have noticed that this function is not taking calculating the ISO week number as the excel expression I mentioned WEEKNUM (Date,21)

1656673066877.png
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top