Search code examples
sqletlsnowflake-cloud-data-platformmatillion

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.


Solution

  • 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.