Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

How to find second largest number among 6 numbers using nested if else ?

Need to find second largest number among 6 numbers using nested if else ! if anyone can help that will be great 
 Thanks

4 Replies

  • DOLEARY85's avatar
    DOLEARY85
    Icon for Resident Rockstar rankResident Rockstar

    Hi,

     

    does it have to be nested if else, would a measure not work just to find the 2nd largest number:

     

    2nd max =
    var _max = CALCULATE(MAXX('Table (2)','Table (2)'[Column1]),ALL('Table (2)'))
    var _2ndmax = MAXX(FILTER('Table (2)', 'Table (2)'[Column1] <> _max),'Table (2)'[Column1])

    RETURN
    _2ndmax
     

    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

    • Anonymous's avatar
      Anonymous
      Not applicable

      Yes DOLEARY85 - unfortunately, I need if else, But thanks for your suggestion.😊  

      • DOLEARY85's avatar
        DOLEARY85
        Icon for Resident Rockstar rankResident Rockstar

        Is the if  else in power query or as a measure/column in report view?