Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr Sales Problem

Hi Qlik Community,

I have a unique use case, where I need to take the Aggregate of Margin. Below is the example

RegionMarginAggr Margin
A-2065
B1565
C-3065

In the example, Margin is simply taking Sum of sales - sum of costs. We want to create another column called aggr margin, which takes the absolute value of Margin and adds them up. In our example the correct # is 65 because (20+15+30).

I've attached the sample app.

Hope this made sense.

Thanks in advance.

Regards

Vishal

3 Replies
Not applicable
Author

Ex: LOAD * INLINE

[     Region, Sales, Cost     A, 100, 120     B, 40, 25     C, 300, 330 ];

Ex1:

Load Region ,

Sales ,

Cost,

Sales - Cost as Margin

Resident Ex;

DROP Table Ex;

join(Ex1)

Load sum(fAbs(Margin)) as aggrmargin

Resident Ex1;

maxgro
MVP
MVP

sum(total aggr(fabs(sum(Sales)-sum(Cost)),Region))

Not applicable
Author

Somehow you both helped me find what i was looking for. Thanks Santosh and Massimo.