Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone
Can we use sum function on script level i.e at the time of loading?
Hi Kumar,
You can use Sum(), Max(),...aggregate functions in script, but you need to group the dimensions. Check below example
LOAD
Dim1,
Dim2,
Sum(Dim3) AS Sales
FROM DataSource
GROUP BY Dim1, Dim2;
Note:The fields specified in Load statement must contain in Group by, otherwise you will get error.
Hope this helps you.
Regards,
Jagan.
what about Dim3 ,should it also be in Group By ?
Hi,
The dimensions which are using in Aggregate functions like Sum() need not to be in Group by.
Regards,
Jagan.
Hi
see this script
b:
load * inline [
invoiceno,amount,city
1,100,a
2,100,a
3,100,b
4,200,c
5,200,e
6,300,f
2,300,a
];
LOAD invoiceno,Sum(amount) as newamount Resident b Group by invoiceno ;