Forum Discussion

TcT85's avatar
TcT85
Icon for Helper III rankHelper III
2 years ago
Solved

DAX - Get the highest Median value from multiple columns.

Could anyone please help me create the dax formula.   Is there a way to get the highest median value from multiple products for a product/date?   Product Serialnumber Date Time Machine 1 ...
  • Gabry's avatar
    Gabry
    2 years ago

    Alright, if you prefer not to unpivot the columns (which might not be the best approach anyway), you can proceed as follows:

    1)Create a measure for each machine that calculates the median, like this:

     

    machine1Median = MEDIAN('Table (3)'[Machine 1])
    machine2Median = MEDIAN('Table (3)'[Machine 2])

     

    ...and so on, for each machine you have.

     

    2)Then, to find the maximum of the medians, you can use the following formula:

     

    maxmedian = MAXX(
    UNION(
    SUMMARIZE('Table (3)', 'Table (3)'[Product], "Median", [machine1Median]),
    SUMMARIZE('Table (3)', 'Table (3)'[Product], "Median", [machine2Median])

     

    (...and so on, for each machine you have)


    ),
    [Median]
    )

     

    3)Lastly, you can display the products and their corresponding maximum median in a table visual