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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors