Power Query Date Week Of Year

e103050_1

New Member
Joined
Dec 8, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
I have created a column in a power query that returns the week number of dates with week start day of Friday using the following;

= Table.AddColumn(#"Inserted Week of Year RFT", "W_RFT", each Date.WeekOfYear([RFT],Day.Friday), Int64.Type)

and another column for year;

= Table.AddColumn(#"Inserted Week of Year RFT", "Year", each Date.Year([START FAB]), Int64.Type)

but I need to a week column "Year_WeekNumber" like "2020_19"
target table as below;
anyone hep me to create function in excel power query?

1638951699001.png


RFTWeek
5/19/2021​
2021_20
2/3/2021​
2021_5
5/20/2021​
2021_20
2/3/2021​
2021_5
7/18/2021​
2021_29
3/24/2021​
2021_12
3/24/2021​
2021_12
3/24/2021​
2021_12
3/24/2021​
2021_12

any idea?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"RFT", type date}}),
    #"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([RFT]), Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Inserted Year", "Custom", each Date.WeekOfYear([RFT],Day.Friday)),
    #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Added Custom", {{"Year", type text}, {"Custom", type text}}, "en-US"),{"Year", "Custom"},Combiner.CombineTextByDelimiter("_", QuoteStyle.None),"Week")
in
    #"Merged Columns"

Book6
DE
1RFTWeek
25/19/20212021_20
32/3/20212021_5
45/20/20212021_20
52/3/20212021_5
67/18/20212021_29
73/24/20212021_12
83/24/20212021_12
93/24/20212021_12
103/24/20212021_12
Sheet1
 
Upvote 0
Solution
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Power Query Date Week Of Year
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Power Query Date Week Of Year
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.

I am sorry about forgetting for providing the cross posting link
Thank you very much alansidman:)
 
Upvote 0
I am sorry about forgetting for providing the cross posting link
No worries!
Just be sure to do that if you Cross-Post in the future, and it won't be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,684
Messages
6,173,826
Members
452,535
Latest member
berdex

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