locked
Need to understand MEDIAN() calculation results RRS feed

  • Question

  • Hi experts,

    Assuming I have 4 values:
    4.0,
    0.2,
    0.2,
    3.1
    The result I expect for the MEDIAN of those numbers is 0.2, but PowerBI gives a result of 1.6. I don't see how 1.6 could be the median result of these 4 values.  The actual value of each row is 4.0, 0.2, 0.2, and 3.1. Maybe this is a stupid question, thanks any one who can explain this for me.

    Thursday, July 12, 2018 10:26 PM

Answers

  • Hi Bob_Tang,

    Thanks for your question.

    The median of an even number of observations is usually defined as the mean of the two middle values. Excel and Power BI's MEDIAN functions both follow this convention.

    In your example, with four observations, the median would be the mean of 0.2 and 3.1 which is approximately 1.6.

    For more information, please refer to below document:
    https://msdn.microsoft.com/en-us/query-bi/dax/median-function-dax


    Best Regards
    Willson Yuan
    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Proposed as answer by Darren GosbellMVP Friday, July 13, 2018 4:10 AM
    • Marked as answer by Bob_Tang Friday, July 13, 2018 8:25 PM
    Friday, July 13, 2018 12:54 AM

All replies

  • Hi Bob_Tang,

    Thanks for your question.

    The median of an even number of observations is usually defined as the mean of the two middle values. Excel and Power BI's MEDIAN functions both follow this convention.

    In your example, with four observations, the median would be the mean of 0.2 and 3.1 which is approximately 1.6.

    For more information, please refer to below document:
    https://msdn.microsoft.com/en-us/query-bi/dax/median-function-dax


    Best Regards
    Willson Yuan
    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Proposed as answer by Darren GosbellMVP Friday, July 13, 2018 4:10 AM
    • Marked as answer by Bob_Tang Friday, July 13, 2018 8:25 PM
    Friday, July 13, 2018 12:54 AM
  • Hi Willson,

    Thanks for your help,really appreciated it.

    Friday, July 13, 2018 8:25 PM