Forum Discussion

twister8889's avatar
twister8889
Icon for Helper V rankHelper V
6 years ago
Solved

N values MIN/MAX EDITOR QUERY

Hi guys,   I have some data like the table below, I need to find the N min/max values per period to calculate the average, for example, in the first row:   Average Min: I find the Values from mo...
  • Fowmy's avatar
    6 years ago

    twister8889 

    You can create two measures for AverageX measures and a table to select the count:

    Download the file: https://1drv.ms/u/s!AmoScH5srsIYgYNqGMDklTewnvq8Cw?e=YVNfc3

     

     

     

    Avg Max = 
    
    AVERAGEX(
        TOPN( [RnageNo] , 'Table' , 'Table'[Value] ,DESC),
        'Table'[Value]
    )
    
    Avg Min = 
    
    AVERAGEX(
        TOPN( [RnageNo] , 'Table' , 'Table'[Value] ,ASC),
        'Table'[Value]
    )
    
    RnageNo = SELECTEDVALUE(Range[Value],2)

     



     

    Range = 
    GENERATESERIES( 1 , 
        CALCULATE(
            COUNTROWS('Table'),ALL('Table' )
        ),1
    )

     

    ________________________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon on the right if you like this reply 🙂

    YouTube, LinkedIn