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

Invalid expression error in script while reload data

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

1 Solution

Accepted Solutions
avinashelite

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;


View solution in original post

5 Replies
tresesco
MVP
MVP

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.

Anonymous
Not applicable
Author

Hi

Thanks for your reply.

Can I put sales in group by condition?

Thanks,

Raj

avinashelite

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 ??

Anonymous
Not applicable
Author

I need to include sales also ...Can i take above script?

avinashelite

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;