Forum Discussion
MagikJukas
3 years agoResolver III
Max value from each table
Hello, I would like to add a column to each table in the "Rows" column where it calculate the Max value from the Indexstart column. thanks
collinsg
3 years agoSolution Sage
Hello MagikJukas ,
The following is an inelegant approach which creates temporary columns as stepping stones to the final result. I'm sure it could be made more elegant with some work. The code presumes your previous step is called "Previous Step". The method is
- Add a column which is "Max Indexstart".
- Add a column which is "Rows" with a "Max Indexstart" column added.
- Remove the temporary columns.
- Rename the "Copy Rows and Add Max Indexstart" column to "Rows".
#"Added Max Indexstart col" = Table.AddColumn(
#"Previous Step",
"Max Indexstart",
each List.Max([Rows][Indexstart])
),
#"Rows + Max Indexstart" = Table.AddColumn(
#"Added Max Indexstart col",
"Copy Rows and Add Max Indexstart",
each Table.AddColumn(
[Rows],
"Max Indexstart",
each List.Max(#"Added Max Indexstart col"[Max Indexstart])
)
),
#"Remove staging columns" = Table.RemoveColumns(#"Rows + Max Indexstart",{"Rows", "Max Indexstart"}),
#"Rename column as Rows" = Table.RenameColumns(#"Remove staging columns",{{"Copy Rows and Add Max Indexstart", "Rows"}})
Hope this helps and that you find a more elegant solution.