Forum Discussion
AndrewPF
Helper V
4 years agoreturn a single value based on maximum value of another column
I have a simple two-column table, similar in layout to this:
| Group | Total |
| Red | 504 |
| Green | 714 |
| Yellow | 923 |
| Blue | 258 |
| White | 432 |
| Black | 805 |
| Orange | 601 |
| Purple | 80 |
from which I need to find the maximum value of Total, and the Group to which it belongs.
I use the MAX function to find the maximum Total, but how can I get the Group associated with that maximum?
- Anonymous4 years ago
Hi AndrewPF
Something like this? Is it possible you have more than 1 Group for the max Total?
test = CALCULATE(VALUES('Table'[Group]),'Table'[Total]=MAX('Table'[Total]))
3 Replies
- AnonymousNot applicable
Hi AndrewPF
Something like this? Is it possible you have more than 1 Group for the max Total?
test = CALCULATE(VALUES('Table'[Group]),'Table'[Total]=MAX('Table'[Total]))- AndrewPF
Helper V
I used it, and it worked, thanks.
But then I tried it with MIN:
test = CALCULATE(VALUES('Table'[Group]),'Table'[Total]=MIN('Table'[Total]))
and it did not return the correct result.
There is no duplication between the numbers.
Any ideas?
- AndrewPF
Helper V
Ignore last message.
It works with MIN too.
Thank you