Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlik Community,
I have a unique use case, where I need to take the Aggregate of Margin. Below is the example
Region | Margin | Aggr Margin |
A | -20 | 65 |
B | 15 | 65 |
C | -30 | 65 |
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
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;
sum(total aggr(fabs(sum(Sales)-sum(Cost)),Region))
Somehow you both helped me find what i was looking for. Thanks Santosh and Massimo.