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: 
Not applicable

Sum plus selection

HI, i have a query which looks like this:

SELECT DATE(c.date_register) AS DATECAST, COUNT(c.id) AS customers

FROM customer c

GROUP BY DATE(c.date_register)

it gives me the number of new customers per date.

Now i want  a chart, where i have on the left a selection of years, and in the graph the sum of the customers.

I managed to do this, but only i have 1 problem:

For example: when i select the years 2013 and 2014 in a list, i want the graph to start with the sum of customers until 2013, and then add the sum of customers for the years i selected (2013 and 2014), per year.

thanks!!!

customers.jpg

1 Reply
thierrytt1102
Partner - Creator II
Partner - Creator II

HI,

I'd use a set analysis syntax like

sum({<Year={"<$(=vMinYear)"}>} Customers) + sum(Customers)

where vMinYear = Min(Year) as a Variable.

Hope it helps