0

Median value

Greetings, is the median function available for use? I was unable to find it in the manual. Thanks.

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Laura, 

    To get the median you have to use a formula like this: 

     

    let mynumber := ((select 'My table') order by Number).Number;
    let mycnt := cnt(mynumber);
    let mymedian := if even(mycnt) then
    (item(mynumber, mycnt / 2) + item(mynumber, mycnt / 2 + 1)) / 2
    else
    item(mynumber, mycnt / 2)
    end;
    mymedian

     

    Best, Jörg

    Like
    • Laura
    • Laura
    • 4 yrs ago
    • Reported - view

    Sweet! Thanks, Jörg; that’s a huge help.

    Like
Like Follow
  • 4 yrs agoLast active
  • 2Replies
  • 1602Views