Skip to main content
Announcements
Happy New Year! Cheers to another year of collaboration, connections and success.
cancel
Showing results for 
Search instead for 
Did you mean: 
risabhroy_03
Partner - Creator II
Partner - Creator II

Sum of rows

Hey, I have a column Quantity.

I added that column as a dimension, so multiple correct values are coming.

risabhroy_03_0-1658761049391.png

 

I only want a single row but all my quantity should be added. I used sum(Quantity) but it gave me a very large value.

I even tried the below code but the Quantity is coming wrong.

[Final_Sort]:

Load
Company_Code,
[Company BP],
[Company BP Name],
[Customer Code],
[Customer Name],
[Customer Currency],
[Customer Group],
[CCTY],
[Customer Country],
[Market Segment],
[Application],
[Market Type],
[Region],
[MIS Category],
[Channel],
[Channel Description],
[Company BP - Customer Code],
[Delivery Terms Description],
[Payment Term Code],
[Payment Term Description],
[Payment Term Days],
[Delivery Terms Code],
Sum([Quantity_WHINR110]) as Quantity


Resident [Final_Customer_Final]
Group By
Company_Code,
[Company BP],
[Company BP Name],
[Customer Code],
[Customer Name],
[Customer Currency],
[Customer Group],
[CCTY],
[Customer Country],
[Market Segment],
[Application],
[Market Type],
[Region],
[MIS Category],
[Channel],
[Channel Description],
[Company BP - Customer Code],
[Delivery Terms Description],
[Payment Term Code],
[Payment Term Description],
[Payment Term Days],
[Delivery Terms Code];

Drop Table [Final_Customer_Final];

exit script;

 

But loading it as a dimension gives me correct result but I want it in a single line.

 

4 Replies
Digvijay_Singh

Syntax looks okay, how many rows you have got in the table Final_Sort?

risabhroy_03
Partner - Creator II
Partner - Creator II
Author

i got duplicate records that is why this is happening.

i want to remove them.

i used Load Distinct but it is not removing duplicates.

Digvijay_Singh

I don't see distinct in your script, if possible u may attach sample data over here to try with..

risabhroy_03
Partner - Creator II
Partner - Creator II
Author

I later added in my script.

my records are showing unique in straight table but if i use count of any dimension I get a huge value even on using distinct