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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
fabionogarotto
Contributor II
Contributor II

Customers with no sales

Hello all,

I would like to create a table with the list of customers with no sales, based on the current filters (e.g. year, agent, ...).

I have the following tables:

- Customers: IdCustomer is the key field, I must consider only the customers with flActive as 1, and IdAgent based on the filter

- Invoices: list of the documents (document rows are in a separate table), each with DocumentDate and IdCustomer

 The table should list all the customers with flActive = 1, based on the current filters, that have no invoice in the selected time period.

Is it possible to create such table? Any suggestion?

Thank you very much,

Fabio

Labels (2)
1 Solution

Accepted Solutions
martinpohl
Partner - Master
Partner - Master

create a table

add dimension from your customer table (eg name)

add an expression like

sum({<flActive={1}>}1) - Count({<flActive={1}, Number={"*"}>} Name)

every customer with flActive = 1 gets a 1.

then every customer with a Number (eg the invoice number) based on selections is substracted.

Also set under add-ons show null values to deselected.

Regards

View solution in original post

3 Replies
martinpohl
Partner - Master
Partner - Master

create a table

add dimension from your customer table (eg name)

add an expression like

sum({<flActive={1}>}1) - Count({<flActive={1}, Number={"*"}>} Name)

every customer with flActive = 1 gets a 1.

then every customer with a Number (eg the invoice number) based on selections is substracted.

Also set under add-ons show null values to deselected.

Regards

fabionogarotto
Contributor II
Contributor II
Author

Thank you,

a couple of doubts on this:

The first column is the Name, then I add another column (as measure?) with the expression you wrote. This column shows 0 if the customer has sales, 1 if it has no sales.

Rows with 0 are filtered out thanks to the add-ons flag.

But then when I use a global filter, such as Year= 2019, all the rows disappear.

When I use agentId filter, it works because it's a detail of the customer table.

I would like to have all the customers with no sales on the selected year, too.

This is the current expression (I realized I must accept flActive with values from 0 to 9)

sum({<flActive={"<10"}>}1) - count({<flActive={"<10"},Number={"*"}>}Name)

 

Thank you!

Fabio

fabionogarotto
Contributor II
Contributor II
Author

Hello,

for future reference, you can override the year filter on the first sum with

sum({$<Year=,flActive={"<10"}>}1) - count({<flActive={"<10"},Number={"*"}>}Name).

 

Thank you,

Fabio