[Wranglers] Calculating Geometric Mean using SQL

Ali, Saqib docbook.xml at gmail.com
Mon Mar 25 13:51:25 UTC 2024


Recently I had to calculate the Geometric Mean of columns in a table using
SQL. To calculate the geometric mean, you have to first multiply all values
and then take the nth root of that number, where n is the number of values
in the column. There is no function in SQL to calculate the Geometric Mean.
So I developed a Recursive CTE SQL to accomplish the task. Recursive CTE
SQL available on Github:
https://qosf.com/calculating-geometric-mean-of-values-in-a-column-using-SQL.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://analyticsengineering.net/pipermail/wranglers/attachments/20240325/53533dad/attachment.htm>


More information about the Wranglers mailing list