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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

TOTAL sum of sum(aggr(sum(cost), year)) with condiditons

Hello Community,

here I am again. I figured out some basics about the aggr() function but I still have some problems. I m describing my problem here:

What I have is

Variables

x = 1.500.000,00 €

y = 1.000.000,00 €

This is my tables:

contract_begin_yearcost_acquisitionSales Percentage< 100%?Output y
20171.117.910,81 €74,53 %yes , return something else745.273,87 €
20162.606.979,59 €173,80 %no, return y1.000.000,00 €
20151.452.900,07 €96,86%yes, return something else968.600,05 €
TOTAL SUM5.177.790,47 €2.713.873,92 €

for the column "cost_acquisition" I used the expression

-> Sum(Aggr(sum(cost_acquisition), contract_begin_year))

I know that I could just add sum(cost_acquisition), but I will need this expression later on in a text box

Now I added some condiditions like

if the Sales Percentage is < 100% it should calculate

-> Sum(Aggr(sum(cost_acquisition), contract_begin_year)) / x


if the Sales Percentage is > 100% it should return the variable y = 1.000.000 €

this is my expression:

= if(Sum(Aggr(sum(cost_acquisition), contract_begin_year))/x < 1, Sum(Aggr(sum(cost_acquisition), contract_begin_year))/x * y, y)

What I need the the total result of Output y = 2.713.873,92 € which I can write as an expression in a text box

I m still not fit into aggr() expressions or set analysis. Hope someone can help me out here.

0 Replies