How to Calculate Median Function in Azure Data Flows?

Viewed 37

I am trying do median on the numeric column in the aggregate transform, but i am unable to find median function.

How can I solve Median in azure data flows

1 Answers

To get median of numeric value, first we have to use collect() function within the aggregate so that we may have an index for each value to locate the center and a count() function to keep track of how many indexes there are present in column.

enter image description here

After that in derived column activity create a median column and defined formula using columns created in aggregate activity.

If length of column is odd

salarycollection[toInteger(round(salarycount+1)/2)]

enter image description here

If length of column is even

(salarycollection[toInteger(round(salarycount+2)/2)]+salarycollection[toInteger(round(salarycount)/2)])/2

enter image description here

My sample data

enter image description here

Output

for odd enter image description here for even enter image description here

Related