Search code examples
powerbidaxpowerquery

in DAX or Power Query, How to return the max value for each row in?


I want to return the max value in this case dates for each row, I want to return the last time between worker 1, 2 and 3 for each row in column "Last time".

Original Table and columns

enter image description here

Resulting table and columns enter image description here

In excel this is super simple MAX(A1,B1,C1), MAX(A2,B2,B2)....

in Dax I create a column

LT1 = MAX(example[Worker 1],example[Worker 2])

Then another column

Last Time = max(example[la1],example[Worker 3])

I get the right results but I was hopping for more elegant solution than that.

Thank You,

I try this as well but it did not work

MaxValue = MAXX('Table', {MAX('Table'[Column1]), MAX('Table'[Column2]), MAX('Table'[Column3])})

Thanks!


Solution

  • DAX with a Calculated Column

    MaxValue = MAXX({[Worker 1], [Worker 2], [Worker 3]}, [Value])
    

    PowerQuery with a Custom Column

    List.Max({[Worker 1], [Worker 2], [Worker 3]})