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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mg-66
Regular Visitor

Highest 5 MAX Values in a single Column

Hello Guys,

 

I need your Help. I have a Column with Temperature Values we measured.

I would like to calculate the average of my highest 5 values for example.

 

I would appreciate every answer.

Thanks!

 

Best Regards,

MG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mg-66 ,

 

According to my understanding, you want to calculate the top5 average of each Time(same Hour and Minute), right?

Please use the following formula to create Rank and Average measure:

Rank = RANKX(FILTER(ALL('Table'), HOUR([Time])=HOUR(MAX('Table'[Time])) && MINUTE([Time])=MINUTE(MAX('Table'[Time]))),  CALCULATE ( MAX ( ( 'Table'[Tmax]) ) ),,DESC,Dense)
Average = CALCULATE(AVERAGE('Table'[Tmax]),FILTER(ALL('Table'),  HOUR([Time])=HOUR(MAX('Table'[Time])) && MINUTE([Time])=MINUTE(MAX('Table'[Time]))&& [Rank]<=5))

Output:

Eyelyn9_0-1636609494247.png

 

Best Regards,
Eyelyn Qin
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

7 REPLIES 7
Anonymous
Not applicable

Hi @mg-66 ,

 

According to my understanding, you want to calculate the top5 average of each Time(same Hour and Minute), right?

Please use the following formula to create Rank and Average measure:

Rank = RANKX(FILTER(ALL('Table'), HOUR([Time])=HOUR(MAX('Table'[Time])) && MINUTE([Time])=MINUTE(MAX('Table'[Time]))),  CALCULATE ( MAX ( ( 'Table'[Tmax]) ) ),,DESC,Dense)
Average = CALCULATE(AVERAGE('Table'[Tmax]),FILTER(ALL('Table'),  HOUR([Time])=HOUR(MAX('Table'[Time])) && MINUTE([Time])=MINUTE(MAX('Table'[Time]))&& [Rank]<=5))

Output:

Eyelyn9_0-1636609494247.png

 

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

Thanks for your Help @Anonymous .

I appreciate your work.

mg-66
Regular Visitor

Thanks for your quick answer.

I need TOP 5 based just on thier Value. 

@mg-66 , if you do not have any other column than temperature, then add index column in power query and create this measure

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

Top5 = calculate(AverageX(values(Table[Index]), calculate(sum(Table1[Temperature]))),TOPN(5,allselected(Table[Index]),sum(Table1[Temperature]),DESC))

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

@amitchandak 

I am doing something wrong, it's not calculating the average. So I will show you how my Data looks like and in what I am interested exactly.

 

DateTimeTmax
05.11.202110:26:04.15986,7
05.11.202110:26:05.457104,7
05.11.202110:26:06.692118,3
05.11.202110:26:07.84297,4
05.11.202110:26:09.02982,6
05.11.202110:26:10.20988,3
05.11.202110:26:11.387106
05.11.202110:26:12.578114,4
05.11.202110:26:13.741

108,4

05.11.202112:44:42.11384,2
05.11.202112:44:43.95795,4
05.11.202112:44:45.889111,4
05.11.202112:44:47.555104,6
05.11.202112:44:49.326115,8
05.11.202112:44:50.962131,6
05.11.202112:44:52.636111,9
05.11.202112:44:54.184111,9
05.11.202112:44:55.841104,9
05.11.202112:44:57.458112,7
05.11.202112:44:59.142107,4
05.11.202112:45:00.809123,9
05.11.202112:45:02.464111
05.11.202112:45:04.132111,8
05.11.202112:45:05.787111,7
05.11.202112:45:07.362121,5

 

The Blue Measurements were taken at a different time. I have a filter in my Layout to distinguish between these Measurements.

So I want to pick the highest 5 Values of Tmax and calculate the average from these values. My integrated Filter will automatically use just one of the Measurements (the marked black or marked blue ones).

 

The Average of my top 5 peaks shoud be: 110,36 °C

 

 

 

mg-66
Regular Visitor

The Data is separated in 3 Columns.

amitchandak
Super User
Super User

@mg-66 , Assume you need top 5 based on Date

 

Top5 = calculate(AverageX(values(Date[Date]), calculate(sum(Table1[Temperature]))),TOPN(5,allselected(Date[Date]),sum(Table1[Temperature]),DESC))

 

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Users online (1,964)