Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I have a table of data and a DAX measure that states:
"Most Apples = CALCULATE(VALUES('Pickings[Person]),'Pickings'[Apples]=MAX('Pickings'[Apples]))"
I get the error "Table of multiple values was supplied where a single value was expected". I understand why this is. Is there a way of handling this exception, I don't care if Jake or James is returned, I just want one of the names to be returned given they have the maximum apples. Thanks.
Person | Apples |
John | 5 |
James | 7 |
Jake | 7 |
Solved! Go to Solution.
@ompowerbi
Apologies for the late response. apparently I did not pay much attention to your question. Please use
Most Apples =
CALCULATE (
MAX ( 'Pickings'[Person] ),
'Pickings'[Apples ] = MAX ( 'Pickings'[Apples] )
)
If you know that there will only be 1 entry per name you can use
Most apples =
SELECTCOLUMNS (
TOPN ( 1, Pickings, Pickings[Apples], DESC, Pickings[Name] ),
"@val", Pickings[Name]
)
To guarantee only 1 result is returned you could use Power Query to add an index column and then use that index column as a sort parameter in TOPN, to act as a tie breaker if multiple people with the same name bought the same number of apples.
Hi @ompowerbi
please try
"Most Apples = CALCULATE( SELECTEDVALUE ('Pickings[Person]),'Pickings'[Apples]=MAX('Pickings'[Apples]))"
Hi, thank you, I now get a (blank), not James or Jake, as the return using the measure above.
@ompowerbi
This depends on your filter context. Would you plase share ascreenshot of your visual for better understanding of you are trying to do. Please hide any sensitive data only keeping the whole picture.
My data is the same as in the original question. This is what I get from your suggestion.
@ompowerbi
Apologies for the late response. apparently I did not pay much attention to your question. Please use
Most Apples =
CALCULATE (
MAX ( 'Pickings'[Person] ),
'Pickings'[Apples ] = MAX ( 'Pickings'[Apples] )
)
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
11 | |
11 | |
10 | |
6 |