Forum Discussion
Extracting Values From a List & Inserting in Table at Specific Rows
- 5 years ago
Hello Andyb431
try this approach. Use your BenefitGUID-table and add a new column where you inserting you Timeline-table on every row. After that you expand the table
let Base_AnalysisTimeline= let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSBEyagkkzMGkOJi2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Count = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Count", Int64.Type}}) in #"Changed Type", BenefitGUID = #table({"Benefit GUID"}, {{"U1B1"}, {"U1B2"}, {"U1B3"}}), Multiply = Table.AddColumn ( BenefitGUID, "BaseAnalysisTimeLine", each Base_AnalysisTimeline ), Expand = Table.ExpandTableColumn(Multiply, "BaseAnalysisTimeLine", {"Count"}, {"Count"}) in ExpandCopy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello Andyb431
try this approach. Use your BenefitGUID-table and add a new column where you inserting you Timeline-table on every row. After that you expand the table
let
Base_AnalysisTimeline=
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSBEyagkkzMGkOJi2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Count = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Count", Int64.Type}})
in
#"Changed Type",
BenefitGUID = #table({"Benefit GUID"}, {{"U1B1"}, {"U1B2"}, {"U1B3"}}),
Multiply = Table.AddColumn
(
BenefitGUID,
"BaseAnalysisTimeLine",
each Base_AnalysisTimeline
),
Expand = Table.ExpandTableColumn(Multiply, "BaseAnalysisTimeLine", {"Count"}, {"Count"})
in
Expand
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hi Jimmy,
First, thanks very much for helping! Super useful!
I have a couple of questions where I don't quite understand how the code is working due to my limited knowledge:
1) For the Base_AnalysisTimeline table, why did you use the Table/JSON, etc. method to create the table rather than the usual "Source = Currentworkbook() etc."? Is there an advantage of doing it this way?
2) For "BenefitGUID = #table({"Benefit GUID"}, {{"U1B1"}, {"U1B2"}, {"U1B3"}})", I guess I could replace this with a query which calls List.Distinct from my existing Benefits_Calc table and remove the other columns to create a table from that? The number of GUIDs will vary over time, so I will need the table to update row numbers dynamically.
Thanks again!
- v-xuding-msft5 years agoCommunity Support
Hi Andyb431 ,
Jimmy801 is right. You could just add the column "Benefit GUID" into another table and then expend it. I have created a simple sample using your file. Please have a try.