Forum Discussion
magnuus_DNB
2 years agoFrequent Visitor
Convert a column with both text and table rows into text and combined text string
Hi, I am quite new to power query, and I am not able to find a solution to my problem. I have a table based on an xml file, and I am trying to expand the file into a table. The issue occurs...
- 2 years ago
use Value.Is to find out what the data type of the cell is, and then handle the contents accordingly.
- 2 years ago
I ended up on this solution. 🙂
#"Add new column and convert to list" = Table.AddColumn(#"Last step", "Name new column",
each if Value.Type([name original column]) = Value.Type("text") then [name original column]
else Table.ToList([name original column])),
#"Convert list to string" = Table.TransformColumns(#"Add new column and convert to list", {"Name new column",
each if Value.Type(_) = Value.Type("text") then _
else Text.Combine(List.Transform(_, Text.From), ","), type text}),
#"Remove old column" = Table.RemoveColumns(#"Convert list to string",{"name original column"})
lbendlin
2 years agoSuper User
use Value.Is to find out what the data type of the cell is, and then handle the contents accordingly.