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...
  • FrankAT's avatar
    6 years ago

    Hi twister8889 

    here is my solution. Use the following measures:

     

    Sum of Value = SUM('Table'[Value])
    
    Highest = 
    CALCULATE (
        AVERAGEX (
            TOPN ( 'TopN'[TopN Value], 'Table', [Sum of Value], DESC ),
            'Table'[Value]
        ),
        ALL ( 'Table' )
    )
    
    Lowest = 
    CALCULATE (
        AVERAGEX (
            TOPN ( 'TopN'[TopN Value], 'Table', [Sum of Value], ASC ),
            'Table'[Value]
        ),
        ALL ( 'Table' )
    )

     

    You can dowmload the pbix file here.

    Regards FrankAT