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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DAX_ConfusesMe
New Member

Display First Instance of MAX Value for Card

Hi,

 

I am trying to use a measure to determine which time has the highest amount of traffic. The goal is to display the Time with the highest amount on a Card within PowerBI. The problem I run into is there are two values, both with the highest amount and I receive an error. In this case, I would want to display the first instance (in the example below, I need the return value as 10:00am).

 

Error: MdxScript(Model) (4, 41) Calculation error in measure 'Sheet1'[MAX Interval]: A table of multiple values was supplied where a single value was expected.

 

I am using this: 

Max Interval = CALCULATE(VALUES(Sheet1[Time]),FILTER(Sheet1,Sheet1[Amount]=MAX(Sheet1[Amount])))

 

Sample Table

StoreDOWTimeAmount
ATuesday10:00 AM100
ATuesday10:30 AM99
ATuesday11:00 AM100
ATuesday11:30 AM87
BTuesday10:00 AM33
BTuesday10:30 AM77
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @DAX_ConfusesMe 

 

Try this

Max Interval = CALCULATE(MIN(Sheet1[Time]),FILTER(Sheet1,Sheet1[Amount]=MAX(Sheet1[Amount])))

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Write these measures:

Total amount = SUM(Data[Amount])
Measure = FIRSTNONBLANK(TOPN(1,VALUES(Data[Time]),[Total amount],DESC),1)

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
PhilipTreacy
Super User
Super User

Hi @DAX_ConfusesMe 

 

Try this

Max Interval = CALCULATE(MIN(Sheet1[Time]),FILTER(Sheet1,Sheet1[Amount]=MAX(Sheet1[Amount])))

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Ugh. I had the wrong filter. Thank you. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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