Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need a calculate and add as a separate column in a table by using load statement.
Product:
Load
XX_date,
Product_type,
Amount
from table1;
Final:
Load
XX_date,
Product_type,
(MOM_formula) as MOM //here if Month is march,the value should be difference of march&February and so on
from table1;
Drop table table1;
Please help how to give MOM formula in Script
Thanks 🙂
My bad 🙂 How about this?
Load
Month,
Value as Sum,
Value-Previous(Value) as PreMonthDiff;
load
Date(MonthStart(Date),'MM-YYYY') as Month,
Sum(Value) as Value
Inline [
Date,Value
03.01.2018,50
18.01.2018,60
19.02.2018,23
14.03.2018,21
23.03.2018,37
]
Group by Date(MonthStart(Date),'MM-YYYY');
Hi vivethakumar,
Yoou can use RangeSum function to make it work.
Sample Script:
Load
Month,
Value as Sum,
RangeSum(Value,peek(RunningSum)) as RunningSum;
load
Date(MonthStart(Date),'MM-YYYY') as Month,
Sum(Value) as Value
Inline [
Date,Value
03.01.2018,50
18.01.2018,60
19.02.2018,23
14.03.2018,21
23.03.2018,37
]
Group by Date(MonthStart(Date),'MM-YYYY');
Hope it helps..
Thanks Kaanerisen,
you have added the values, but i need difference of current vs previous month formula in script.
My bad 🙂 How about this?
Load
Month,
Value as Sum,
Value-Previous(Value) as PreMonthDiff;
load
Date(MonthStart(Date),'MM-YYYY') as Month,
Sum(Value) as Value
Inline [
Date,Value
03.01.2018,50
18.01.2018,60
19.02.2018,23
14.03.2018,21
23.03.2018,37
]
Group by Date(MonthStart(Date),'MM-YYYY');