If I have a table that has a few native fields, such as: monthly written premium. But I used that field in combination with some date logic to calculate and create fields in the query called: CY YTD Written premium; PY YTD Written premium; and PY Written Premium.
How can I use those created fields in another calculation further down in the query.
What I need to do is take YTD Written Premium - PY YTD Written Premium + CY YTD Written Premium to create LTM Written Premium.
Snowflake will not allow me to reference the 3 fields needed to make LTM because they are not native to the table.
I know it has to be some sort of embedded query, but I'm unsure on the syntax.
