Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Fonte = Excel.Workbook(File.Contents("C:\Users\alex\Desktop\\stock_acumulated.xlsx"), null, true),
stock_Table = Fonte{[Item="stock",Kind="Table"]}[Data],
#"start" = Table.TransformColumnTypes(stock_Table,{{"code", Int64.Type}, {"date", type date}, {"trans_id", Int64.Type}, {"Index", Int64.Type}, {"amount", Int64.Type}, {"day amount", Int64.Type}}),
ListOfIndex = List.Buffer(#"start"[Index]),
ListOfamount = List.Buffer(#"start"[amount]),
//Function Start
fxGetAccum=(ListOfIndex, ListOfamount)=>
let
FunctionResult = List.Generate(()=>[x=ListOfamount{0},i=0], each [i]<List.Count(ListOfIndex), each [i=[i]+1, x=(if ListOfIndex{i}=0 then 0 else [x]) + ListOfamount{i}], each [x])
in
FunctionResult,
//Function End
Result = Table.FromColumns(Table.ToColumns(#"start")&{fxGetAccum(ListOfIndex, ListOfamount)},Table.ColumnNames(#"start")&{"Accumulated"})
in
Result
great, where can'I learn this about ?
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Fonte = Excel.Workbook(File.Contents("C:\Users\alex\Desktop\\stock_acumulated.xlsx"), null, true),
stock_Table = Fonte{[Item="stock",Kind="Table"]}[Data],
#"start" = Table.TransformColumnTypes(stock_Table,{{"code", Int64.Type}, {"date", type date}, {"trans_id", Int64.Type}, {"Index", Int64.Type}, {"amount", Int64.Type}, {"day amount", Int64.Type}}),
ListOfIndex = List.Buffer(#"start"[Index]),
ListOfamount = List.Buffer(#"start"[amount]),
//Function Start
fxGetAccum=(ListOfIndex, ListOfamount)=>
let
FunctionResult = List.Generate(()=>[x=ListOfamount{0},i=0], each [i]<List.Count(ListOfIndex), each [i=[i]+1, x=(if ListOfIndex{i}=0 then 0 else [x]) + ListOfamount{i}], each [x])
in
FunctionResult,
//Function End
Result = Table.FromColumns(Table.ToColumns(#"start")&{fxGetAccum(ListOfIndex, ListOfamount)},Table.ColumnNames(#"start")&{"Accumulated"})
in
Result
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 15 | |
| 14 | |
| 11 | |
| 8 | |
| 8 |