Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Cumulative List of List of Lists

Hello,

 

I am trying to create cumulative lists of several nested lists in a list of list. Right now I can only get it to run one specified nested list but I would like it to run on all nested list and present a list of lists with the cumulative data as a result.

 

Here is my list of list and in the first nested list you can see that I have some values that I want to create a cumulative list from.

 

= Table.ToColumns(Table.Buffer(#"Removed Columns1"))

 

nilszon_0-1636453035447.png

 

Here I have created a operator thata create a cumulative list using List.Accumulate. But I have to specify that I want it to be the first list, BufferedTables{0}, for it to run. 

 

= List.Skip(List.Accumulate(BufferedTables{0},{0},(state,current)=> state & {List.Last(state) + current}))

 

nilszon_1-1636453050806.png

If I do not specify which nested list to run I get this error. 

 

= List.Skip(List.Accumulate(BufferedTables,{0},(state,current)=> state & {List.Last(state) + current}))

 

nilszon_2-1636453060723.png

 

Can this be done in a way that I do not have to hardcode the amount of lists I want it to run? instead I just want it to go through all nested lists in the list of lists. 

 

 

1 REPLY 1
lbendlin
Super User
Super User

Is the nesting level dynamic?  You may want to look into recursive functions (not just iterations, true recursions).

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.