Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi everyone
My data looks like (all of them are text type):
Month1 | Month | Year |
01 | January | 2022 |
02 | February | 2022 |
03 | March | 2022 |
04 | April | 2022 |
05 | May | 2022 |
I am only showing these months of 2022, but I have data since 2005.
I want to create a new column, Month.Year, that combines both "Month" and "Year" if Month equals "Gener". If else it should state just Month. So it would look like:
Month1 | Month | Year | Month.Year |
01 | January | 2022 | January 2022 |
02 | February | 2022 | February |
03 | March | 2022 | March |
04 | April | 2022 | April |
05 | May | 2022 | May |
06 | June | 2022 | June |
07 | July | 2022 | July |
08 | August | 2022 | August |
09 | September | 2022 | September |
10 | October | 2022 | October |
11 | November | 2022 | November |
12 | December | 2022 | December |
01 | January | 2021 | January 2021 |
Solved! Go to Solution.
Use following formula in a custom column
= if Number.From([Month1])=1 then [Month]&" "&Text.From([Year]) else [Month]
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfJKzCtNLKoEsowMjIyUYnWilYyAHLfUpCJ0cWMgxzexKDkDWdAEyHEsKMrMQRY0BatEaI4FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month1 = _t, Month = _t, Year = _t]),
#"Added Custom" = Table.AddColumn(Source, "Month.Year", each if Number.From([Month1])=1 then [Month]&" "&Text.From([Year]) else [Month])
in
#"Added Custom"
Use following formula in a custom column
= if Number.From([Month1])=1 then [Month]&" "&Text.From([Year]) else [Month]
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfJKzCtNLKoEsowMjIyUYnWilYyAHLfUpCJ0cWMgxzexKDkDWdAEyHEsKMrMQRY0BatEaI4FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month1 = _t, Month = _t, Year = _t]),
#"Added Custom" = Table.AddColumn(Source, "Month.Year", each if Number.From([Month1])=1 then [Month]&" "&Text.From([Year]) else [Month])
in
#"Added Custom"
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
15 | |
15 | |
13 | |
12 | |
11 |