This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I have a table which contains a range of prices with corresponding year, and want to calculate the geometric mean by distinct year.
At present, I'd do this in SQL using the following query:
select distinct [Year], exp(avg(log([Price]))) as [Geomean]
from [Table]
group by [Year]
Is there a straight-forward way to replicate in Alteryx, perhaps using a custom expression with Summarize tool (if that's actually possible)?
Ideally, any solution should be flexible in terms of the grouped values (e.g. multiple values, spatial references etc.). My immediate thought is to use a SQL query in the input and control parameters using action tools. However, it'd be incredibly useful to crunch the numbers mid-workflow.
Cheers,
Mike
Solved! Go to Solution.
Could you test if the following gets you matching results to your SQL query:
I think that should match what you are getting from SQL but definitely test to make sure! Unfortunately it doesn't look like there is a way to create a custom formula in the summarize tool.
Thanks, Nick. Far simpler than I'd envisaged! Hadn't even occurred to me to break the expression down in that way...
Much obliged.
Cheers, Joe. Works a treat.