Forum Discussion
Extracting and Flattening an embedded table within a data set
- 1 year ago
NewStep=#table(Table.ColumnNames(YourTableName),List.TransformMany(Table.ToRows(YourTableName),each List.Zip(List.Transform(List.Skip(_,2),each Text.Split(_,","))),(x,y)=>List.FirstN(x,2)&y))
- 1 year ago
Thanks CaptOdyssey
It is now more sensible now,
please use the below code which Source is related to the table you presented here.
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], #"Merged Columns" = Table.CombineColumns(Source,{"RateDifferentialPercentages", "RateDiffEffectiveDTs"},each List.Zip(List.Transform(_, (x)=> Text.Split(x,","))),"Merged"), #"Expanded Merged" = Table.ExpandListColumn(#"Merged Columns", "Merged"), Custom1 = Table.SplitColumn(#"Expanded Merged","Merged", each _) in Custom1If you have any question, just ask me
- 1 year ago
Hello and thank you for your proposed solution. Unfortunately, I cannot figure out how to apply your suggestion. How would I add your suggested new step to the code below?
let
Source = Table.Combine({RateDifferentials2}),
#"Filtered Rows" = Table.SelectRows(Source, each [StdRateDiffEffectiveDTs] <> null and [StdRateDiffEffectiveDTs] <> ""),
#"Changed Type" = Table.TransformColumnTypes(#"Filtered Rows",{{"StdRateDiffEffectiveDTs", type text}}),
What is your desired result?
The desired result would look something like this
tract_No | Title | RateDifferentialPercentages | RateDiffEffectiveDTs |
ABC000001 | CustomerContract1 | -3 | 01/12/2018 10:30:00 AM |
ABC000001 | CustomerContract1 | 0 | 01/01/2019 10:30:00 AM |
ABC000002 | CustomerContract2 | 2 | 01/01/2023 10:30:00 AM |
ABC000002 | CustomerContract2 | 0 | 01/01/2025 10:30:00 AM |
- Omid_Motamedise1 year agoSuper User
Thanks CaptOdyssey
It is now more sensible now,
please use the below code which Source is related to the table you presented here.
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], #"Merged Columns" = Table.CombineColumns(Source,{"RateDifferentialPercentages", "RateDiffEffectiveDTs"},each List.Zip(List.Transform(_, (x)=> Text.Split(x,","))),"Merged"), #"Expanded Merged" = Table.ExpandListColumn(#"Merged Columns", "Merged"), Custom1 = Table.SplitColumn(#"Expanded Merged","Merged", each _) in Custom1If you have any question, just ask me
- CaptOdyssey1 year agoRegular Visitor
Omid, thank you for the response. I think I understand most of what you have proposed. Can you explain how "List.Transform(_, (x)=> Text.Split(x,","))" works?