Forum Discussion
Generate a Custom Navigation Table with List.Generate
- 4 years ago
Here is a proof of concept for the child level
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitWBsIzgLGM4ywTMcgKpM0AwDRFMIwTTGMFE0maqFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Added Custom" = Table.AddColumn(Source, "Custom", each #table({"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{{[Column2],{[Column2]},"your function here " & [Column2],"Table",[Column2],true}})), #"Grouped Rows" = Table.Group(#"Added Custom", {"Column1"}, {{"Group", each _, type table [Custom=table]}}), #"Added Custom1" = Table.AddColumn(#"Grouped Rows", "Children", each Table.Combine([Group][Custom])) in #"Added Custom1"You would still need to call the NavTable function on the "Children" tables and then on the "Column1" tables to tie it together, but you can already see the dynamic approach.
You need to use the fourth parameter (the selector) to combine the results.
List.Generate(
() => [x = 1, y = {}],
each [x] < 10,
each [x = List.Count([y]), y = [y] & {x}],
each [x]
)
Just keep in mind that this will result in ever larger chunks of data being handed around on each loop.
alternatively use List.Accumulate or recursive functions.
Please provide sample data in usable format (not as a picture - maybe insert into a table?) and show the expected outcome.
- JackSoderstrom4 years agoHelper I
I actually updated my question to this https://community.powerbi.com/t5/Developer/Loop-to-create-table/m-p/2069541#M31670
- lbendlin4 years agoSuper User
still hard (for me) to help without sample data and expected outcome.