M is for Data Monkey Chapter 24

MikeDBMan

Well-known Member
Joined
Nov 10, 2010
Messages
610
I am creating a dynamic calendar table as discussed in M is for Data Monkey Chapter 24. I have the following fields, among others: Year and Month, both Whole Numbers. I wish to create a concatenated field, YYYYPP, which is the concatenation similar to this: [year] & right("0" & [month],2), so 2019, May (05) would be 201905 and 2019, December (12) would be 201912. I cannot get the formula to work in Power Query. Please help!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You could use:

Number.ToText([Year]) & Number.ToText([Month],"00")
 
Upvote 0
To insert the new column, my formula is:
Code:
= Table.AddColumn(#"Inserted Day", "YYYYPP", (each Date.Year([Date])), type number)

and I get just the year, 2019, as the result. Since this is a dynamic table, I am not sure I know how to build your formula into the line above. I've been trying for a few hours and nothing works.
 
Upvote 0
I got it. This works:
Code:
= Table.AddColumn(#"Inserted Day", "YYYYPP", each Number.ToText([Year]) & Number.ToText([Month],"00"))

Thanks for the help!
 
Upvote 0
You could amend that to:

= Table.AddColumn(#"Inserted Day", "YYYYPP", each Date.ToText([Date], "yyyyMM"))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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