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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
RMDFA
Regular Visitor

Average of minimum/maximum

I have some very simple data (example below), where a day is broken down into hours (0-23), each with some values from another table. I need to create two measures that return the average of the minimum values and the average of the maximum values. It will need to calculate properly at a day/week/etc. level as we roll up.

RMDFA_0-1682698553626.png

I see a lot of questions about minimums of averages, but less about averages of minimums. I'm sure it's a simple solution, but I was never able to wrap my head around the "x" functions (minx, sumx, averagex, etc.). Thanks for the help.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@RMDFA 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.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@RMDFA 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.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler - thanks, I got it to work with your examples. Still not sure exactly why or how it works, but hopefully I can figure it out with your blog.

@RMDFA Well, the why and how is basically you are using SUMMARIZE to group based upon the same criteria as you have in your visual is the idea. You add a column either within SUMMARIZE or using ADDCOLUMNS where you calculate your measure for each grouping. Then you use an X aggregator to return the type of aggregation you want like the AVERAGE across all of those summarized values or the minimum or maximum. You could also write it as:

MinOfMeasure = 
  VAR __Table = 
    ADDCOLUMNS(
      DISTINCT('Table'[Group]),
      "__Measure", [Measure]
    )
  VAR __Result = MINX( __Table, [__Measure] )
RETURN
  __Result


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors