Forum Discussion
List.Average and Select rows
Hi Anonymous
You need to assign the outer ROLE column to a variable like below:
let
role = [ROLES]
in List.Average(Table.SelectRows(#"Changed Type",each [ROLES] = role)[WAGE])
- Anonymous1 year agoNot applicable
In my original table I have roles named like "IT support", "Manager of xxx", "Supervisor"... how should I write it pls?
- danextian1 year ago
Super User
let role = [ROLES] in List.Average(Table.SelectRows(#"Changed Type",each [ROLES] = role)[WAGE])I simply updated this part of your formula with the correct syntax:
each [roles] = _[roles]
[ROLES] is a column assigned to the role variable. This should be done whenver you're trying to access a column outside the current scope which in this case is #"Changed Type". Whatever the value of ROLES is it will be assigned to this variable and will be used to filter the previous step which result is carried over in the current step. By not doing this you are simply telling Power Query to return true for all rows.
- Anonymous1 year agoNot applicable
It works. Thank you very much. amitchandak thank you too for your effort.