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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
maxime66
Creator
Creator

Set analysis Year-1

Hi Qlikers,

i would like to get the number of customers (see expression) for the year before the selected one

I tried some set analysis  but results is always 0

2015 : 3

2016 : 4

thx for your help !!

1 Solution

Accepted Solutions
sunny_talwar

May be this

=Count({$<year = {$(=year-1)}>} DISTINCT If(Aggr(Sum({$<year={$(=year-1)}>}sales), salesman, id_customer, year) > 0, id_customer))


Capture.PNG

View solution in original post

4 Replies
sunny_talwar

May be this

=Count({$<year = {$(=year-1)}>} DISTINCT If(Aggr(Sum({$<year={$(=year-1)}>}sales), salesman, id_customer, year) > 0, id_customer))


Capture.PNG

maxime66
Creator
Creator
Author

Thnaks sunny !! perfect

its_anandrjs
Champion III
Champion III

Try to write

=count( {$<year={$(=Max(year)-1)}>} distinct if(aggr(sum({$<year={$(=Max(year)-1)}>} sales),salesman,id_customer,year)>0,id_customer))

Img4.PNG

its_anandrjs
Champion III
Champion III

If you not click on the Year field you did not get any thing on the chart you need dynamically change in expression then use Max in the Expression.

=count( {$<year={$(=Max(year)-1)}>} distinct if(aggr(sum({$<year={$(=Max(year)-1)}>} sales),salesman,id_customer,year)>0,id_customer))