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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Hemanth_Vinay
Frequent Visitor

Print maximum of average of air quality.

Hi everyone, i need to print the city with maximum avg value. i tried applying max function on avg measure its showing me an error. can someone help on how to show to calculate and show the max avg value using DAX?. i added image of list of avg's of all cities below.
Screenshot (10).png

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Hemanth_Vinay 

My understanding is that ultimately you want to compare the average of each city with maximum and minimum averages of all cities. In order to do that you want to add two measures to your matrix. One for minimum average and one for maximum average. The value of the maximum average for example will be the same for all rows. Same for minimum average. Then you can take the difference and maybe percentage. I hope I'm right. Then you can use

Maximum Average =
MAXX ( ALL ( Table[City] ), [Z-Avg air Quality] )

 

Minimum Average =

MINX ( ALL ( Table[City] ), [Z-Avg air Quality] )

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Hemanth_Vinay 

My understanding is that ultimately you want to compare the average of each city with maximum and minimum averages of all cities. In order to do that you want to add two measures to your matrix. One for minimum average and one for maximum average. The value of the maximum average for example will be the same for all rows. Same for minimum average. Then you can take the difference and maybe percentage. I hope I'm right. Then you can use

Maximum Average =
MAXX ( ALL ( Table[City] ), [Z-Avg air Quality] )

 

Minimum Average =

MINX ( ALL ( Table[City] ), [Z-Avg air Quality] )

amitchandak
Super User
Super User

@Hemanth_Vinay , assume you have measure = [Z-Avg Quality Index] or create and use a measure

 

calculate(MAxx(Values(Table[City]) , [Z-Avg Quality Index])

 

 

or

if this is a column -Z-Avg Quality Index

 

calculate(MAxx(Values(Table[City]) ,calculate(Average(Table [Z-Avg Quality Index])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak thanks for helping me out but by using dax function which you have provided, i could only calculate average of each city, but what i want show is a single value of which city has the lowest or highest average.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.