Forum Discussion
Get column value corresponding to another column value in Table.Group
Lets say that I have a table like this in M language:
| A | B | C |
| 1 | 25 | X |
| 2 | 18 | Y |
| 1 | 20 | Z |
| 1 | 23 | W |
I want to group the rows by A and get the min of B from each group, but I also need the corresponding C value of the resulting B. This would be the resulting table in this case:
| A | MinB | CorrespondingC |
| 1 | 20 | Z |
| 2 | 18 | Y |
As you can note, from the rows with value 1 in column A, 20 is the min value of B, and Z is the corresponding value of 20 in column C.
I have been looking for a while but I haven't found a solution for this in M language. I have to do find corresponding values for several aggregations so I want to know if there is any commun procedure, or some at least, to solve this.
Thanks in advance,
You may follow steps below:
1. Duplicate the table, then click Transform-> Group By to general table below:
2. Merge the two tables and remove some useless columns:
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- v-yuta-msft
Community Support
You may follow steps below:
1. Duplicate the table, then click Transform-> Group By to general table below:
2. Merge the two tables and remove some useless columns:
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.