Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Overall sum


Hi,

I have the following fields:

Product, Sales Document (contains multiple product orders), Net Value

I would like to create a table that calculates for every selected product the sum of the Net Value of all deals in which this product was sold.

Eg.

Sales DocProductNet Value
1A1000
1B2000
1C500
2D1500
2E100
2A4000

Result should be:

ProductSum of Deals
A9100 (A appears in both Sales Docs)
B3500
C3500
D5600
E5600

Hope someone can help me with the expression.

Thank you in advance!

Best regards

17 Replies
tresesco
MVP
MVP

Yes, the requirement is a bit hard for a newbie and the front-end solution is harder. You might think of solving it in the script. And don't worry, we all have/had to be a newbie for anything new.

Not applicable
Author

Thanks for your understanding how would you solve that problem in the script?

tresesco
MVP
MVP

Refer jagan mohan 's code above.

Not applicable
Author

How do I apply that on thousands of Sales Documents and products?

tresesco
MVP
MVP

Replace the INLINE load by your load statement like:

Data:

LOAD

          SalesDoc,

          Product,

          NetValue

From <Yoursource>;

INLINE [

SalesDoc, Product, NetValue

1, A, 1000

1, B, 2000

1, C, 500

2, D, 1500

2, E, 100

2, A, 4000];

GroupSum:

LOAD

SalesDoc,

Sum(NetValue) AS OverallSum

RESIDENT Data

Group By SalesDoc;

Not applicable
Author

Awesome, thank you very much!

tresesco
MVP
MVP

I have found an easier front-end solution.

=Sum(Aggr( NODISTINCT Sum([Net Value]), [Sales Doc]))

senpradip007
Specialist III
Specialist III

Thats awesome.