Forum Discussion
ValeriaBreve
3 years agoPost Partisan
Use a formula for a column name
Hello, I am trying to use a formula to call a column name to avoid tedious and long code rewriting (many years to compile....). In particular, I am reading the Year from the column name: YearOfRe...
- 3 years ago
ValeriaBreve You can use this -
GroupedRows = Table.Group ( #"Changed Type", {"Product"}, { { "Amount", (Rows)=> // All Rows & Columns visible for the current Product List.Sum ( Table.Column ( Rows, "Jan" & Number.ToText ( Year ) & "Volume" ) ) } } )
ValeriaBreve
3 years agoPost Partisan
AntrikshSharma Hello, sure! It is used in
#"Grouped Rows" = Table.Group(#"Changed Type", {"Product"}, {{"Amount", each List.Sum([Jan 2016 Volume])}})
So if I replace the [Jan 2016 Volume] with Table.Column( Table, "Jan 2016 Volume" ) I get the summed volume for the whole column, regardeless of the grouping...
AntrikshSharma
3 years agoCommunity Champion
ValeriaBreve You can use this -
GroupedRows =
Table.Group (
#"Changed Type",
{"Product"},
{
{
"Amount",
(Rows)=> // All Rows & Columns visible for the current Product
List.Sum (
Table.Column (
Rows,
"Jan" & Number.ToText ( Year ) & "Volume"
)
)
}
}
)
- ValeriaBreve3 years agoPost Partisan
It works very well! Thank you so much 🙂