https://docs.snowflake.com/en/sql-reference/sql/create-task
You could also use a TASK to load the initial raw data into a raw or staging table and then create a subsequent TASK to run the SQL from the raw into the final or master table where you perform your required calculation.