Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
hi, I have this to give an accumultion and re start at each text value so { "A", 2,3,3,"b","c", 3,4,5,"c",2,3, = "A",2,5,8,"b","c",3,7,12
etc.
let
alist = {"A",2,3,3,"a","b",2,3,3,2,"c",3,2,3,2,3}
in
List.Generate(
()=> [x = 0 ,y = alist{0} , z = y] ,
each [x] < List.Count( alist) ,
each [ x = [x] + 1, y = alist{x} , z = try [z] + y otherwise alist{x} ],
each [z]
)
Coult this be written without try / otherwise and still using generate not accumulate or some other.
Richard.
Solved! Go to Solution.
For your z function, you could check for the type instead:
if y is number and [z] is number then [z] + y else y
Thnks, id used Value.Is in skipping over the text so don't know why I never thought of this.
For your z function, you could check for the type instead:
if y is number and [z] is number then [z] + y else y