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

Sum Distinct with SET Parameter

Hi to all
I have a problem I need to sum distinct values in a range

es.

01/01/201010
02/01/201010
02/01/201010

I want that consider the sum = 20 because on 2/1/2010 there are two same values. I solve the problem with this formula

SUM( AGGR(SUM( DISTINCT (Bdg_vendita)), [Data]))

the problem is that in the same table I need to shows data to the previous year. I try to use this

Sum( AGGR(SUM({ $ <Anno_Fisc={$(ANNO_FISC_PREC)}> } DISTINCT (Bdg_vendita)), [Data]))

and this

Sum({ $ <Anno_Fisc={$(ANNO_FISC_PREC)}> } AGGR(sum( distinct(Bdg_vendita)), Data))

...but it doesn't works... 😞

any ideas ?

THANKS
Andrea

2 Replies
johnw
Champion III
Champion III

I believe you need the set in both places instead of just one or the other. So probably this?

sum({<Anno_Fisc={$(ANNO_FISC_PREC)}>} aggr(sum({<Anno_Fisc={$(ANNO_FISC_PREC)}>} distinct Bdg_vendita),Data))

Not applicable
Author

GREAT IT WORKS !!!

🙂

THKS

Andrea