M is for Data Monkey Chapter 24

MikeDBMan

Well-known Member
Joined
Nov 10, 2010
Messages
608
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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,213,489
Messages
6,113,949
Members
448,534
Latest member
benefuexx

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