Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ompowerbi
Helper I
Helper I

Exception Handling - Table of multiple values was supplied where a single value was expected.

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. 

 

PersonApples
John5
James7
Jake7
1 ACCEPTED 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] )
)

View solution in original post

6 REPLIES 6
johnt75
Super User
Super User

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.

tamerj1
Super User
Super User

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.

ompowerbi_1-1662981402886.png

 

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] )
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.