cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

how to calculate median on azure databricks delta table using sql

PadamTripathi
New Contributor II

how to calculate median on delta tables in azure databricks using sql ?

select col1, col2, col3, median(col5) from delta table group by col1, col2, col3

2 REPLIES 2

-werners-
Esteemed Contributor III

try with the percentile function, as median = percentile 50:

https://spark.apache.org/docs/latest/api/sql/#percentile

Thank you for youur comment. It worked.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.