Forum Discussion
Anonymous
7 years agoNot applicable
Get Max Value from another column in a different table (Query Editor, M Code)
Is it possible to get the max value from another column in a different table in query editor?
- 7 years ago
Anonymous
Try
List.Max(AnotherTableName[ColumnName])
Zubair_Muhammad
7 years agoCommunity Champion
Anonymous
Try
List.Max(AnotherTableName[ColumnName])
arpost
4 years agoPost Prodigy
Greetings, Zubair_Muhammad! Wanted to extend this post a bit and ask if you know how to use the List.Max to find the value that is <= to the current record's value?
For example, if I have a table like this called Data:
| Date | Value |
| 10/1/21 | 100 |
| 11/1/21 | 200 |
| 1/1/22 | 100 |
And a table like this called Commissions:
| Change Date | Change % |
| 9/1/21 | 10% |
| 12/1/21 | 15% |
I want my M Query to return this in the Data table:
| Date | Value | Change % |
| 10/1/21 | 100 | 10% |
| 11/1/21 | 200 | 10% |
| 1/1/22 | 100 | 15% |
I'm assuming I need to use the List.Max in some sort of "for each" loop.