Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Median function on a MAX column

Hello,

 

I am trying to calculate the median on a max column (Max_DelaiH). I had to create a max column because I have duplicates. 

I tried 

Tmps_Median = VAR __table4 = SUMMARIZE('Documents',[No-QR7],"__value4",[MAX_DelaiH])
RETURN
IF(HASONEVALUE(Documents[No-QR7]),[MAX_DelaiH],MEDIAN(__table4,[__value4]))
 
But I can't do the MEDIAN function on a line.
Can anybody help me? Is there a median function for a line?

 

  • Hi Anonymous ,

     

    Please add function CALCULATE() out side the MEDIAN function or MEDIANX(). Like the following expression.

     

    Tmps_Median = 
    VAR __table4 = SUMMARIZE('Documents',[No-QR7],"__value4",[MAX_DelaiH])
    RETURN
    IF(HASONEVALUE(Documents[No-QR7]),[MAX_DelaiH],
    CALCULATE(MEDIAN([__value4]), '__table4')
    )
     
    OR
     
    Tmps_Median = 
    VAR __table4 = SUMMARIZE('Documents',[No-QR7],"__value4",[MAX_DelaiH])
    RETURN
    IF(HASONEVALUE(Documents[No-QR7]),[MAX_DelaiH],
    MEDIANX(__table4,[__value4])
    )
     

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Community Support

    Hi Anonymous ,

     

    Please add function CALCULATE() out side the MEDIAN function or MEDIANX(). Like the following expression.

     

    Tmps_Median = 
    VAR __table4 = SUMMARIZE('Documents',[No-QR7],"__value4",[MAX_DelaiH])
    RETURN
    IF(HASONEVALUE(Documents[No-QR7]),[MAX_DelaiH],
    CALCULATE(MEDIAN([__value4]), '__table4')
    )
     
    OR
     
    Tmps_Median = 
    VAR __table4 = SUMMARIZE('Documents',[No-QR7],"__value4",[MAX_DelaiH])
    RETURN
    IF(HASONEVALUE(Documents[No-QR7]),[MAX_DelaiH],
    MEDIANX(__table4,[__value4])
    )
     

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, I will try it but I realised I didn't need to do it in the end.