Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculated field

Hello,

I have the following in the script:


.....

Left Join (Facts)

LOAD %ITEM_SKU_KEY,

     %WEEK_KEY,

     Forecast

FROM

Econ\Sales Units Forecast.xlsx

Left Join (Facts)

LOAD %ITEM_SKU_KEY,

     if(%WEEK_KEY=52, 1, %WEEK_KEY+1) as %WEEK_KEY,

     Forecast as ForecastBack

FROM

Econ\Sales Units Forecast.xlsx

Left Join (Facts)

LOAD %ITEM_SKU_KEY,

     if(%WEEK_KEY=1, 52, %WEEK_KEY-1) as %WEEK_KEY,

     Forecast as ForecastForward

FROM

Econ\Sales Units Forecast.xlsx

I need to add the following "ForecastX" field to the "Facts" table, which is calculated based on the "ForecastBack" and "ForecastForward" fields, which were created earlier in the script (see above).


The "ForecastX" is defined to be:


ForecastX = 0.5*ForecastBack + 0.5*ForecastForward


Any idea?


Thanks



1 Solution

Accepted Solutions
Not applicable
Author

Try this: LEFT JOIN(Facts) LOAD 0.5*ForecastBack+0.5*ForecastForward as ForecastX RESIDENT Facts;   

View solution in original post

1 Reply
Not applicable
Author

Try this: LEFT JOIN(Facts) LOAD 0.5*ForecastBack+0.5*ForecastForward as ForecastX RESIDENT Facts;