Math.sum on list

I have a list and wanna do Math.sum within sublists of list. I tried with @list but still not working. As in picture attached, I want sum of numbers under marked 0 List, 1 List and so on. I dont know how should i remove the extra lists under these main lists i.e these four lists under marked 0 List and son on. Because when i use List.flatten , it removes lists from other endh3

Try List.Flatten but @L3 (or 2 - I get this one wrong often enough).

it do not sum the number at @L3 also and also chnage the structure of list.h4

@shershahbacha9 First I’d advice trying to simplify the list structure, if possible.
If not possible, you could try something like this …


@Vikram_Subbaiah I dont wanna change the list structure as i need it in the end. Its areas for each level and these empty lists should also go on so at the end shows that at this level we dont have any building mass. For this reason, i was trying to replace empty lists to a string but still trying due to complex list structure. Now i tried your this suggestion but it changes the list structure and empty lists are also removed which i dont want.

The input nodes are blue in my example because I’ve checked Keep List Structure
Doing the same on the Math.Sum node might get you the intended result.
You’ll need to handle the nulls though

I used Math.Sum two times and it gave me what I wanted. Is It a right way ?

Thanks alot @Vikram_Subbaiah. I did what you suggested and it worked as seem in the SS attached. The problem is im using Revit in German and sometimes cant get what the nodes are saying but this thing could help me in my other problems too. Thanks

1 Like