Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello I want to put in a "Insert Merged Column" step in my power query that merges all columns that begin with the word "Active" and separates them with a semi-colon
So right now i have this step to merge 5 fields into one field called "Final Active"
======================================================
= Table.AddColumn(#"Pivoted Column", "Final Active", each Text.Combine({[Active ABCD Law], [Active ABCD], [Active at time of application], [Active Personal], [Active Current]}, ";"), type text)
======================================================
so i tried using the following statement with a wildcard character Active * but I got a syntax error.
= Table.AddColumn(#"Pivoted Column", "Final Active", each Text.Combine({[Active *]} ";"), type text)
Can you please help me with a solution?
thank you very much!!!
Craig
So i want to Add A column
Solved! Go to Solution.
Use following statement
= Table.AddColumn(#"Pivoted Column", "Final Active", each Text.Combine(Record.ToList(Record.SelectFields(_,List.Select(Table.ColumnNames(#"Pivoted Column"),(x)=>Text.Start(x,6)="Active"))),";"), type text)
something like this?
let
Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HcmhEQAgDATBXl7HkFQAlJGJAPrvAQ6zZjO1ZGrt4RDQVZbahBMQMH4cIggImKq6", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [generic = _t, #"active 1" = _t, #"active 2" = _t, #"active 3" = _t, #"other column" = _t]),
colstomerge= List.Select(Table.ColumnNames(Origine), each Text.StartsWith(_,"active")),
#"Merge di colonne" = Table.CombineColumns(Origine,colstomerge,Combiner.CombineTextByDelimiter(";", QuoteStyle.None),"active final")
in
#"Merge di colonne"
that is perfect. Thank you very very much!
the reason i need this is that sometimes when i do a previous Pivot Qurey step to create these 5 columns, sometimes there is no data in the "Attribute" column to create all 5 so i might get 3 or 4 columns instead of 5 columns ...thats why i need to merge all columns that begin with "Active" because all the columns to merge, whether its 1, 2, 3, 4 or all 5 columns, start with the word "Active" thank you!!
Use following statement
= Table.AddColumn(#"Pivoted Column", "Final Active", each Text.Combine(Record.ToList(Record.SelectFields(_,List.Select(Table.ColumnNames(#"Pivoted Column"),(x)=>Text.Start(x,6)="Active"))),";"), type text)
Nice.
I came up with something similar:
= Table.AddColumn(
#"Pivoted Column",
"Final Active",
each
Text.Combine(
Record.FieldValues(
Record.SelectFields(
_,
List.Select(
Record.FieldNames(_),
each Text.StartsWith(_, "Active")
)
)
),
";"
),
type text
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.