Does anyone know what the easier way is to write a cumulative / running multiplication function in Snowflake? 🥲

I was able to find CREATE AGGREGATE cumulative_mul(NUMERIC) (SFUNC = numeric_mul, STYPE = NUMERIC);
for Postgresql but so far have not found a way in Snowflake that runs for me or that I understand (no coding background) 🥲 any tips are appreciated!!

like
Posting as :
works at
You are currently posting as works at

To write a cumulative or running multiplication function in Snowflake, you can use the EXP and LN functions to calculate the cumulative product across rows. Here's a simple example:
sql
WITH data AS (
SELECT $1 AS x
FROM values (1), (2), (3), (4), (5)
)
SELECT x, EXP(SUM(LN(x)) OVER (ORDER BY x)) AS cumulative_product
FROM data;

This will calculate the cumulative product of the x values. If you have a table with the x values, you can replace the WITH data AS (...) part with your table name and column. This approach uses the natural logarithm and exponentiation to achieve the cumulative multiplication.
If you prefer a more programmatic approach, you can also create a User-Defined Table Function (UDTF) to calculate the cumulative product.
These methods leverage the LN and EXP functions, as well as window functions, to achieve the cumulative multiplication in Snowflake

helpful

ChatGPT?!!

Related Posts

Sooo who’s working on Pfizer’s covid vaccine?

like

Do you think independent agencies will be in better shape to handle COVID-related client budget reductions and/or losses?

Or does it not matter and layoffs are equal across the board?

likesmart

Looking for ETL testing role. Can join in one month. Preferred location is pune. Total exp - 7.3 yrs Skills- Informatica, SQL, Unix Any referrals please suggest.

like

Hey Folks ,

Can you help me understand the PF deductions in Coforge CTC, Is it just the employers contribution ? And employees share will be deducted from Gross Monthly Salary?
Also about LTA , Can i opt out of it and get it as taxable amount?

Thanks in Advance 🙂

like

Did anyone left coforge recently? I have to leave by next week, and company asked to courier their laptop back to office.

like

I got 15.80 CTC(Fixed+ Variable) from coforge. Please help me with in hand salary? Thanks in advance.

Post Photo
like
like

Is it bad if I already find myself disliking my job 1 month in? Did anyone feel this way at first and then grow to like what they do?

like

Anyone have experience setting up more in-depth analytics for portfolio websites? Any ways to get more information about who is looking at my book? I'm on squarespace. Cheers!

like

Brand new baby lawyer dumb question - I am tasked with drafting response to request to produce. How long should this take? And follow up… how do I bill this?

like

Any thoughts on Unified? I think they do paid social

like

Weighing whether another year of IB experience would be helpful, or would just make me one year older at the same starting point in PE.
I’m 1.5 years out of college as an analyst at a middle market bank within the healthcare M&A group. Getting worked a lot but starting to operate as an associate on deals. Debating accepting an offer for a newer, lower-MM healthcare and growth focused PE firm. I know I want to go to PE at some point, but what are some thoughts on when you should go?

like

Can we do a quick round robin of salaries for folks in the Seattle area? Currently making $146K at Starbucks. 32 yo woman. Yes, I know the comparison game is unhealthy, but my hypothesis is I don’t make all that much compared to others which might justify why I am not motivated to work beyond 9-5pm. Former consultant here who took a pay cut so am looking to NOT grind.

like

What's the best city in UK to buy a buy to let property, with best returns?

like

My wife and I bought our first houseplant. I have no idea what this plant is, but it's pretty! Our goal is not to kill it. It's two weeks since we bought it, so fingers crossed 🤞

Post Photo
like

Thought I would try planting marigold seeds indoors this year and oh my goodness

Post Photo
like

Aisa confidence kaha se ata hai bhai

Post Photo
funnylikehelpful

I was hired to work on one account as the only writer. Told they’re handing me another account (or they may hire another writer). I need and want more responsibility and $$. How to negotiate??

Hi everyone, what kind of industries are available for tax? I don’t want to do public accounting anymore. Hours are too long. Thanks!

like

Additional Posts in Data & Analytics Consultants

How hard is it to get an interview for SWE at FAANG outside of on campus recruiting? I’m in GT’s OMSCS program right now, hoping to take advantage of career fairs this fall, but I don’t know if I’ll have enough time to prepare for the technical interviews before then. I’m worried about missing out on the recruiting opportunity and having to resort to applying online/LinkedIn afterwards. Any insights into this?

like

Is anyone working with Elastic at DoD?

If you were to hang your own shingle as a consultant what BI tool would you use to deliver dashboarding to clients?

Assume that you aren’t plugging in to source systems as I primarily work in CDD.

like

Noob question - I want to consolidate the dates into a single dates column. Would numpy or pandas help me reorganize this dataset effectively or should I do it within excel?

Post Photo
like

What biotech stocks are yall trading right now?

GILD, INO, MRNA

like

Anybody interviewed for a data engineer role for Facebook? I have a SQL and Python coding interview next, any idea on what to expect?

like

Hello, Anyone here from Deloitte Omnia AI who could refer me for an open opportunity.

like

What are some interesting non-tech/insurance/advertising/consulting careers where data science is applied? Thinking of epidemiology and economics

like

In the most unnecessarily complicated phrasing worthy a dissertation, what are you working on this week?

like

Has anyone else begun to resent data science?

like

McKinsey & Company Does somebody have experience regarding
compensation differences between
QuantumBlack & McKinsey? I am in the process at
QB and disappointed with the salary that's
proposed. (New grad Data science from top
university applying for London) McKinsey & Company QuantumBlack

like

Meeting with a recruiter at one of the FAANG companies. I won’t be able to move jobs because of H1b /GC at least for the next year. Any idea if I should start off with that or should I just try to understand the work that they have been doing?

like

The longer I do this job, the more I want to accept a tech job... no travel, same / better pay, no annoying clients...

like

What is Accenture’s data scientist interview process like?

like

Could anyone recommend a set of indices that are publicly available and is a good predictor for consumer spend in home renovations ?

like

Business practice: "can you guys build a model that overlays where Coronavirus is going to break out with client sites"

likefunny

KPMG folks, thoughts about Lighthouse relative to other big 4s? About to start the interview process. Coming from EY FSO DDnA

like

I'm non US citizen and thinking of moving back to EU. My plan is getting remote opportunities across the world and work as a freelancer. My speciality is Data analytics and BI (Qlikview, Tableau). 1) How likely I can get a gig from the US? 2) if a job looking for a remote 2-3 months contract do they care what country I'm in? 3) how can I compete Indian rates as I'm in Europe 60-70$ per hour as a BI consultant is a good rate but I see online rates as low 10$😫?

like

Any BCG Gamma fish? Can you please share what kind of analytics projects do you guys do?

likehelpful

What are some of the best online resources to learn Power BI?

like

New to Fishbowl?

Download the Fishbowl app to
unlock all discussions on Fishbowl.
That was just a preview…
Sign Up to see all discussions
  • Discover what it’s like to work at companies from real professionals
  • Get candid advice from people in your field in a safe space
  • Chat and network with other professionals in your field
Sign up in seconds to unlock all discussions on Fishbowl.

Already a user?
Login here

Share

Embed this post

Copy and paste embed code on your site

Preview

Download the
Fishbowl app

See what’s happening in your industry
from the palm of your hand.

A phone with Fishbowl app

Scan your QR code to download
Fishbowl app on your mobile

Download app

Sign up for free to view this conversation on Fishbowl

By continuing you agree to Terms of Use and Privacy Policy

Already have an account? Log in

Sign up for free to continue using Fishbowl

By continuing you agree to Terms of Use(New) and Privacy Policy(New)
Messaging rates may apply

Already have an account? Log in

For account settings, visit Fishbowl on Desktop Browser or

General

Legal