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 have an XML document, for which i am expanding all its elements. What i would like to achieve next is to add a new column, on which i combine the values for any other column where e.g. its name is ending with "group.id". Same to be done for some other columns with other names. I want to do this in order to be able to do some kind of hierarcy and relation at the end between devices, sensors etc.
What i did was the below, which will combine the columns i need, but since it uses the Table.SelectColumns, it will only return the specific columns and not the full table.
#"step1" = Table.ColumnNames(Source),
#"step2" = Table.SelectColumns(Source,List.Select(#"step1", each Text.End(_,8)="group.id")),
#"Added Custom" = Table.AddColumn(#"step2", "Groups", each Text.Combine(List.Transform(List.Skip(Record.FieldValues(_), each _ =""),Text.From),",")),
Is there a way to achive this? Of cource i can duplicate the base table, add the new column there and then merge it, but since it will need a lot of time, i am wondering if there is a way to achive this in one query.
I hope i explained it adequately...
Thanks
George
Solved! Go to Solution.
Try this one
#"step1" = Table.ColumnNames(Source),
#"Added Custom" = Table.AddColumn(Source, "Groups", each
Text.Combine(
List.Transform(List.Skip(
Record.FieldValues(Record.SelectFields(_,List.Select(Record.FieldNames(_), each Text.End(_,8)="group.id"))), each _ =""),Text.From),
",")
)
Try this one
#"step1" = Table.ColumnNames(Source),
#"Added Custom" = Table.AddColumn(Source, "Groups", each
Text.Combine(
List.Transform(List.Skip(
Record.FieldValues(Record.SelectFields(_,List.Select(Record.FieldNames(_), each Text.End(_,8)="group.id"))), each _ =""),Text.From),
",")
)
Basically I am using the same logic
but instead of Table.SelectColumns I am using the equivalent Record.SelectFields function
Please see the attached Excel file as well
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.
User | Count |
---|---|
113 | |
97 | |
85 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |