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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
aibikaidau
Regular Visitor

Help in create Max measure for aggregate value.

I am struggling in creating a dax measure to calculate max unit quantity sold base on column in table visual.

aibikaidau_1-1711782065934.png

I just create a simple measure "Max = Max(table[Total sold]) "and it seem ok in 1st visual but when I remove column restaurant_code it is not right anymore (picture below)

aibikaidau_4-1711782240294.png

Please help. Thank you.

 

1 ACCEPTED SOLUTION

Hi @aibikaidau ,
try the following formula.

MeasureMax = CALCULATE(SUM('Table'[Total Sold]), ALLEXCEPT('Table','Table'[day]))

Drag the measuer into the table visual and the result is shown below.

vjiewumsft_0-1712035518696.png

If the above ones can’t help you get it working, could you please provide the expected result to make a deep troubleshooting? It would be helpful to find out the solution.

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-jiewu-msft
Community Support
Community Support

Hi @aibikaidau ,

Based on my testing, the max function is no problem. When drag the restaurant_code into the table visual, the Max measure will be maximized by a different code. So the result is shown in the first picture.

When removing the restaurant_code column, Total sold will automatically aggregated. So the Max measure will calculate the max value based on the day.

 

please try the following methods:

1.Create the sample table.

vjiewumsft_0-1712030110686.png

2.Create the measure to calculate MAX.

MeasureMax = MAXX(VALUES('Table'[restaurant_code]), CALCULATE(MAX('Table'[Total Sold])))

vjiewumsft_3-1712030325267.png

 

3.If remove the restaurant_code column from the table visual. The result is shown below.

vjiewumsft_4-1712030344745.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

What I want is the measure should show the max of accumulate quantities sold in each day. In your example, if you put Total Sold column in 3rd table, the max should show 109 (sum of 24-Mar-24).

Btw, thank you for your help.

Hi @aibikaidau ,
try the following formula.

MeasureMax = CALCULATE(SUM('Table'[Total Sold]), ALLEXCEPT('Table','Table'[day]))

Drag the measuer into the table visual and the result is shown below.

vjiewumsft_0-1712035518696.png

If the above ones can’t help you get it working, could you please provide the expected result to make a deep troubleshooting? It would be helpful to find out the solution.

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

What answer are you expecting in the second table?  Also, share the download link of the PBI file.


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

@aibikaidau This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Zang_Mi
Resolver II
Resolver II

Hello, it is normal that the measure returns different maximum values since the aggregattion has been done with different granularity levels. More information is needed to solve your problem, for example, a complete sample data for a specific date, with raw data, and the expected aggregation result with and without restaurant_code.

Regards

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.