Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I am getting error like invalid expression while reloading below script. example like
Tab1:
Load Empno,
Empname,
Deptno,
Branch,
Sales,
if(Branch='Pune',Sum(Sales) as value
C:\Users\pdontham\Desktop\ScheduledvsOffCycleReleases.xlsx
(ooxml, embedded labels, table is Sheet1);
Please let me know where i am wrong with the expression.
Thanks,
Raj
You can but sum(Sales) would be same as Sales does not give the result what you needed ...
Try like this
Tab1:
Load Empno,
Empname,
Deptno,
Branch,
Sales,
if(Branch='Pune',Sum(Sales) as value
C:\Users\pdontham\Desktop\ScheduledvsOffCycleReleases.xlsx
(ooxml, embedded labels, table is Sheet1);
Temp:
Noconcatenate
Load Empno,
Empname,
Deptno,
Branch,
Sum( if(Branch='Pune',Sales)) as value
C:\Users\pdontham\Desktop\ScheduledvsOffCycleReleases.xlsx
(ooxml, embedded labels, table is Sheet1)
Group By Empno, Empname, Deptno,Branch;
JOIN(Tab1)
LOAD
Empno,
Empname,
Deptno,
Branch,
value
resident
Temp;
Drop table Temp;
Try like:
Tab1:
Load Empno,
Empname,
Deptno,
Branch,
Sales,
Sum( if(Branch='Pune',Sales)) as value
C:\Users\pdontham\Desktop\ScheduledvsOffCycleReleases.xlsx
(ooxml, embedded labels, table is Sheet1)
Group By Empno, Empname, Deptno,Branch, Sales
;
Note: This would give an error free execution, however, I guess not a very meaningful aggregation though.
Hi
Thanks for your reply.
Can I put sales in group by condition?
Thanks,
Raj
You can, but as tresesco mentioned it would be much meaningful aggregation . Try to remove the Sales column from filed and aggr this will give the results but you could missing the Sales for other regions except Pune
What is your actual requirement ??
I need to include sales also ...Can i take above script?
You can but sum(Sales) would be same as Sales does not give the result what you needed ...
Try like this
Tab1:
Load Empno,
Empname,
Deptno,
Branch,
Sales,
if(Branch='Pune',Sum(Sales) as value
C:\Users\pdontham\Desktop\ScheduledvsOffCycleReleases.xlsx
(ooxml, embedded labels, table is Sheet1);
Temp:
Noconcatenate
Load Empno,
Empname,
Deptno,
Branch,
Sum( if(Branch='Pune',Sales)) as value
C:\Users\pdontham\Desktop\ScheduledvsOffCycleReleases.xlsx
(ooxml, embedded labels, table is Sheet1)
Group By Empno, Empname, Deptno,Branch;
JOIN(Tab1)
LOAD
Empno,
Empname,
Deptno,
Branch,
value
resident
Temp;
Drop table Temp;