Forum Discussion

mg-66's avatar
mg-66
Regular Visitor
4 years ago
Solved

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

  • Anonymous's avatar
    Anonymous
    4 years ago

    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:

     

    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.

7 Replies

  • Anonymous's avatar
    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:

     

    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.

    • mg-66's avatar
      mg-66
      Regular Visitor

      Thanks for your Help Anonymous .

      I appreciate your work.

  • 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))

     

     

  • mg-66's avatar
    mg-66
    Regular Visitor

    Thanks for your quick answer.

    I need TOP 5 based just on thier Value. 

      • mg-66's avatar
        mg-66
        Regular Visitor

        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