Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
453 views
in Technique[技术] by (71.8m points)

sql - to find a the running total for a column containing two project names in matillion ETL

enter image description hereenter image description here

I want to calculate the running total separately for two project names(menlo park and SFO-BAB) in matillion etl I've already calculated the running total for both the project names combined but I need to do it separately. I've added the screenshot for reference.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I assume you want to calculate a running total for the column UnitsConsumed for every projectName:

Select
projectName,
UnitsConsumed,
SUM(UnitsConsumed) over (partition by projectName order by reportingFromDate)
FROM waterConsumption

If you only want to see Menlo Park or SFO-BAB, you have to filter your result accordingly.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...