CUME_DIST returns the cumulative distribution of a value in a group of values. The result is the number of rows preceding and including the row in the window ordering of the window partition divided by the total number of rows in the window partition. Rows with the same values in the ordering will evaluate to the same distribution value.

No Parameters

Returns: decimal



SELECT account, order_value, CUME_DIST() OVER ( PARTITION BY account ORDER BY order_value desc)
  FROM jun_2017_orders


account order_value cume_dist
Betasoloin 5182 0.2
Betasoloin 5100 0.4
Betasoloin 4492 0.6
Betasoloin 2887 0.8
Betasoloin 1036 1.0
Gekko & Co 5622 0.14285714285714285
Gekko & Co 5304 0.2857142857142857
Gekko & Co 5031 0.42857142857142855
Gekko & Co 1075 0.5714285714285714