Forum Discussion
Shimonkepha
1 year agoRegular Visitor
How to deal with multiple data types in a column: some rows are tables and others text
The ones with tables have values, shown on the preview. I can only drill down or add as new query. How do I get the values from the tables
- 1 year ago
Shimonkepha I would create 2 new columns that separate out Table values from text values. Then you can work with the Table values without getting errors. Once you have what you need, you can always recombine the 2 columns into a single column once again. PBIX is attached below signature:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WckxJSU1R0lFycQxx1DU0MlaK1YlWCkrNzS/DFHbOz83NLClBSJiYmoElUAwxt7BUio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [NAME = _t, KEY = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"NAME", type text}, {"KEY", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"KEY"}, {{"Table", each _, type table [NAME=nullable text, KEY=nullable text]}}), #"Appended Query" = Table.Combine({#"Grouped Rows", #"Table (2)"}), #"Added Custom" = Table.AddColumn(#"Appended Query", "Custom", each if Value.Is(Value.FromText([Table]), type text) then [Table] else null), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each if Value.Is(Value.FromText([Table]), type text) then null else [Table]), #"Expanded Custom.1" = Table.ExpandTableColumn(#"Added Custom1", "Custom.1", {"NAME"}, {"NAME"}), #"Added Custom2" = Table.AddColumn(#"Expanded Custom.1", "Custom.1", each if [Custom] = null then [NAME] else [Custom]), #"Removed Columns" = Table.RemoveColumns(#"Added Custom2",{"Custom", "NAME"}) in #"Removed Columns"
dufoq3
Community Champion
1 year agoShimonkepha, you havent attached source file. We can't use your pbix file without source MS Project to PBI test Data Date 2025-01-17.xml file...
Shimonkepha
1 year agoRegular Visitor
Here is the source file link https://drive.google.com/file/d/1SGuPwy70JoV_zNbUQb-JaSrqTER8fgNF/view?usp=drive_link
- dufoq31 year ago
Community Champion
Hi Shimonkepha, in Assignments table, add this code as a new step:
= Table.FromColumns(List.TransformMany(Table.ToColumns(#"Expanded TimephasedData"), each {Table.Combine(List.Select(_, (x)=> x is table))}, (x,y)=> List.Combine({List.Select(x, (r)=> not (r is table))} & Table.ToColumns(y)) ), {"Value"} )