Wrong calculations JUST when running FIRST TIME query
I've made a script in teradata with some kpi's like sales, sales percentage etc, and I am running this script through python ( i've made the datamart in teradata, saved the file and i created a function in python that reads this script) .
The script have some temporary tables and finally it writes the output in a set table in DW.
When I run first time this, it gives me wrong values (i can check it easily in percentage because it gives me values like 2000% that doesn't make sense...) and when I run it second time, it goes well...
Does anyone have an ideia of why this is happening?