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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis for formula like sum(a-b)

Hi,

I'm trying to create an expression with SET.

It is easy to do this...

sum ( {$<....>} a) - sum ( {$<....>}  b)

BUT... how do i do it when i want it to be SUM (a - b), applying the same set analyis for both a and b?

Thanks,

10 Replies
whiteline
Master II
Master II

It calculates right:

(158.40 - 3.63 ) / 158.40 = 98%

You have to write true expression without 'Total Mode' Tricks.

The problem is that to achive 42.63 you need to apply fabs to every row while in your expressions

fabs(column(3) - Column(1))

it applies to the total values.

Use

=sum(aggr(fabs(sum(QUANTITY_FORECAST_F2) - sum(QUANTITY_REAL)), ZONE, PRODUCT, SUB ZONE))

it gives the sum of absolute differences for all rows and for each row.