Search code examples
powerbidaxpowerbi-desktopdaxstudio

Second Highest number in MAX function using DAX


I have a variable as below VAR First_Higest_number = MAX( 'DF'[Number_Column] ) and I would like to find the Second_Higest_numberin DAX. How to get around with this ? many thanks in advance.


Solution

  • You might use the search first, as it seems to be a duplication
    VAR Second_Higest_number = MINX ( TOPN ( 2, 'DF', 'DF'[Number_Column] ), 'DF'[Number_Column] )