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

Newish to data analytics. Have some experience in power BI, sql, and R. I wanted to get some exposure to aws and saw the AWS cloud practitioner as an available course at my job. Is this cert worth it? Or should I try one of the more advanced ones ? The data analytics one for example but wasn’t sure if it would be difficult to get through as a beginner. Will it look good on my resume?

like

I got variable pay of 1 lack, two times after April's appraisal (so total 2 lack). I didn't had variable component mentioned in offer letter, but it was showing up in hr portal. Now payroll people are calling me and asking me to return the 1 lack saying it was done by mistake. What should I do?

A sleepy summer Sunday watching the end of a great test cricket match, grabbing a beer with friends and glorious weather. Honestly it is the first day since covid that life feels normal for me

like

Hey Guys,

need some help.

my DOJ & Notice period is conflicting by 5 days. None of the party agreeing to adjust.

New Employer (Oracle) mentioned that his budget will expire by May 31 so cloudn't shift the DOJ.

What should I do now ?

like

How many of you have a set curriculum and how many of you get to choose the literature/create your own content? Which do you prefer?

like

Hey everyone, I have been posting about TikTok vs Cepheid about which job offer to take and I have started my first few days at Cepheid biotech and I love it so far. Flexible start/end times, interesting work, great WLB, job security, and career growth is all there! Thank you to everyone who helped me hear different perspectives about two different companies and career paths. Thanks guys!!

likeuplifting

I'm reaching the point in my career where visibility in the company is more important for promotions than my technical skills. I hate networking with a burning passion. Should I just give up on getting promotions? I already make more money than I need.

like

Equifax What is the salary bracket for 6 years experience candidate at Equifax in Atlanta and also St Louis?

likefunny

This is second time I got offer from CGI but now I have again a better opportunity. So if this time I reject will there be any problem for me in future?

Anyone familiar with the various BP&O groups within Facebook?

Hi Fishes,

I have been invited for an interview for a Senior Associate position at PWC AC's ethics and compliance department. I am currently a Senior(TL) at EY, will this position of a senior associate be a sort of demotion for my career?

like

I'm a little worried about microplastics in my food. Is this just hysteria?

like
like

Does anyone here work BlackRock? What’s your ex experience so far?

like

Hi all
I am a senior system engineer with 3 years of experience in ReactJs.
I am desperately looking for a change right now.
It will be greatful if I can get few referrals

like

How can I break into CSR? There don’t seem to be many roles at the associate level

like

Anyone in the market for bags? Looking to sell a Celine Luggage, Celine Belt Bag, Givenchy Antigona and an LV Neverfull. All great for work!

like

Hi fishers, Has anyone bought a new vehicle and registered it under BH series of RTO? If yes, then what all documents do we need from our HR/Company?

like

Just got a lowball offer... sigh. Had my expectations set at $150k minimum. They’ve come in at $140k. Have a competitor about to close at $180k but like them less. Wish me luck these next few days! (Everything else is similar and $140k is only slightly better than current pay).

like

Folks - when you calculate the total diluted share counts, does the result have to tie to the reported diluted share counts on the most recent filing (either 10K or 10Q)?

like

Additional Posts in Data & Analytics Consultants

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

like

Newish to data analytics. Have some experience in power BI, sql, and R. I wanted to get some exposure to aws and saw the AWS cloud practitioner as an available course at my job. Is this cert worth it? Or should I try one of the more advanced ones ? The data analytics one for example but wasn’t sure if it would be difficult to get through as a beginner. Will it look good on my resume?

like

This might be a long shot ... but I have a Statistics assignment due for tonight in a few hours

Does anyone know how to do Linear Discriminant Analysis with more than one predictor - by hand? I know how to compute in R but my professor wants it done by hand .... fml

likefunny

What’s the best/simplest way to understand Sets vs Groups in tableau?

like

My manager continues to ask me to help other teams and do work on other billable projects. I’m sick of it .. and I’m going to explicitly say that no I can’t do it because my hours are taken by the existing project we are doing. Is this appropriate?

like

Is there a good online course on storytelling with data? Something that can help structure your thought process and design choices when creating visualizations and Dashboards in Tableau, Power BI etc.

like

Any recommended courses or books on customer care/cust success analytics or marketing analytics in general?

like

I was hired a few months ago by D to do data science. I am not doing data science currently, is there a way I can switch roles internally? Should I talk to my coach? Or should I just start looking for a new job. I’m starting to feel that the field is so hot rn my small stint at D won’t be a big deal to other firms.

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

What are the top sales & marketing metrics that tech companies track? I have an interview for a Data architect role and the data aspect is my strength but need to brush up on the business insight part

like

How does everyone in this bowl feel towards master’s degrees in data science/analytics? I didn’t study this in undergrad so I’m looking to get an analytics degree but I’ve heard mixed reviews.

like

When industries refer to business intelligence engineers, are they looking at a senior level or entry level? Some of these job descriptions seem rather outlandish in terms of years of experience required like 5+

like

Learning cloud architecture right now so apologies if these are obvious questions: Best ways to store video metadata to perform analysis on it? I'm looking at AWS and GCP. Saw that Cassandra would be good for it, but not sure what the GCP equivalent is? But also I'm a bit confused on if Cassandra is just a DB and storage would need to be elsewhere? All help is welcome! I've been spinning my wheels on Google trying to understand

like

What biotech stocks are yall trading right now?

GILD, INO, MRNA

like

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

like

Anyone who has done masters in business analytics Singapore? Could you help on courses, Scholarships and careers and jobs. Looking for help.

Any conda users in here have to install a binary and use conda forge? Need some help installing pdftotext. Throwing a weird message saying “Found conflicts!” Any and all help would be appreciated.

like

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

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

1) Hypothetically if you were looking to sabotage a colleague, can you code an excel document to throw off their numbers or calculations, (if you send them that document and they download it for use)?

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