Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hai All, I need help with this requirement on this which we want to do in the power query editor.
Background
I work on the sales dashboard, so every month users will send a new version table with the same schema, so I use the appending option for every month to append every table.
So based on this column we can assure the different versions which appending every month(Attaching below)
And now I want to create one custom conditional numerical column based on this
Requirement
For 2021 versions will go like this format
V5-May-2021
V6-June-2021
V7-July-2021
V8-August-2021
V9-September-2021
V10-October-2021
V11-November-2021
V12-December-2021
based on 2021 data is ok but what about 2022 or Coming years it will be collapse
1st requirement
So I want to create one custom numerical column that should only present numerical values
for eg. v5-may-2021 For the custom should only return 5
2nd requirement
From the next year 2022
The custom column values should show like this 122 , 222, 322 , 422, etc(1 Is the version, 22 is the year)
From the next year 2023
The custom column values should show like this 123, 223, 323 , 423, etc(1 Is the version, 23 is the year)
So desired Custom column output
| Custom column |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 122 |
| 222 |
| 322 |
| 422 |
The top table from 8 to till 12 shows 2021 versions data and down it is showing next year's (2022) desired values
and this should be dynamically created for every version.
Note: this I want to do in power query as a custom column
please help me to achieve this logic
Solved! Go to Solution.
Hi @AlanP514
Here is the sample file with the solution https://we.tl/t-lkm4UtAKrG
This the PQ code
let
Source = Excel.Workbook(File.Contents("C:\Users\Tamer.Juma\TiSUN Dropbox\tamer tisunenergy\Tamer - Personal\Work\PBI Community\Community 2\Community 161.xlsx"), null, true),
Versions_Sheet = Source{[Item="Versions",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Versions_Sheet, [PromoteAllScalars=true]),
Version = Table.AddColumn(#"Promoted Headers", "Text Between Delimiters", each Text.BetweenDelimiters([Version], "V", "-"), Int16.Type),
Year = Table.AddColumn(Version, "Text After Delimiter", each Text.AfterDelimiter([Version], "20"), Int16.Type),
#"Change to Intiger" = Table.TransformColumnTypes(Year,{{"Text Between Delimiters", Int64.Type}, {"Text After Delimiter", Int64.Type}, {"Version", type text}}),
#"Inserted Addition" = Table.AddColumn(#"Change to Intiger", "Addition", each [Text Between Delimiters] + 100 * [Text After Delimiter], Int16.Type ),
#"Changed Type" = Table.TransformColumnTypes(#"Inserted Addition",{{"Addition", Int64.Type}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Text Between Delimiters", "Text After Delimiter"})
in
#"Removed Columns"
Hi @AlanP514
Here is the sample file with the solution https://we.tl/t-lkm4UtAKrG
This the PQ code
let
Source = Excel.Workbook(File.Contents("C:\Users\Tamer.Juma\TiSUN Dropbox\tamer tisunenergy\Tamer - Personal\Work\PBI Community\Community 2\Community 161.xlsx"), null, true),
Versions_Sheet = Source{[Item="Versions",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Versions_Sheet, [PromoteAllScalars=true]),
Version = Table.AddColumn(#"Promoted Headers", "Text Between Delimiters", each Text.BetweenDelimiters([Version], "V", "-"), Int16.Type),
Year = Table.AddColumn(Version, "Text After Delimiter", each Text.AfterDelimiter([Version], "20"), Int16.Type),
#"Change to Intiger" = Table.TransformColumnTypes(Year,{{"Text Between Delimiters", Int64.Type}, {"Text After Delimiter", Int64.Type}, {"Version", type text}}),
#"Inserted Addition" = Table.AddColumn(#"Change to Intiger", "Addition", each [Text Between Delimiters] + 100 * [Text After Delimiter], Int16.Type ),
#"Changed Type" = Table.TransformColumnTypes(#"Inserted Addition",{{"Addition", Int64.Type}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Text Between Delimiters", "Text After Delimiter"})
in
#"Removed Columns"
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!