Forum Discussion

imagautham's avatar
imagautham
Helper II
4 years ago
Solved

Getting the Maximum number across multiple columns

Hello,   I have data like the below, I need to write a measure to find the maximum value across these 2 columns. The measure should return 900 in the below case. I tried using MAXX but unable to ...
  • ddpl's avatar
    4 years ago

    imagautham  use this

     

    Measure = Var maxproduct1 = MAX('Table'[Prodcut 1 sales])
              Var maxproduct2 = MAX('Table'[Prodcut 2 sales])
              return
              if(maxproduct1 >maxproduct2,maxproduct1,maxproduct2)
    Please accept as solution if its worked
     
  • AlexisOlson's avatar
    AlexisOlson
    4 years ago

    The MAX function will also return the larger of two scalar values, so you could use both functions of MAX like this:

    MAX ( MAX ( 'Table'[Product 1 sales] ), MAX ( 'Table'[Product 2 sales] ) )
  • Ashish_Mathur's avatar
    4 years ago

    Hi,

    That is not the ideal structure to have.  In the Query Editor, you should select the first column, right click and select "Unpivot Other Columns".  Then write this measure and drag it to a card visual

    Max value = max(Data[Value])

    Hope this helps.