Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
JVDS
Contributor
Contributor

Putting the filter in expression - to exclude certain data

Hi,

currently trying to find the average amount of invoices per account while excluding accounts without invoices.
The below filter I have, but I cannot get any further. I tried also with variables and distinctions but I cannot find the proper way to do this.

What I currently have to filter customers from having invoices or not (as a status) is the expression below.
avg (aggr (count (distinct invoicenumber), accountname) = 0, Not Active, Active)

Facts:
Accounts with 0 invoices
Accounts with 1+ invoices

I want the average invoices per account EXCLUDING the accounts with 0 invoices.

*note, I don't want to use the filter "Active" to have the diagram show the average invoices. I want to have this inside the expression so there's no other option.

Labels (2)
2 Replies
Wlad_Masi
Employee
Employee

@JVDS  Where are you planning to use this expression?
What is your goal, to show this data in a table with account names as dimension? is yes we can filter on the dimension and not in the measure, maybe.
Can you please say more about your goal?

To help users find verified answers, please don't forget to mark a correct resolution or answer to your problem or question as correct.
dwforest
Specialist II
Specialist II

one solution may be:

Avg({<[AccountName={"=Count(invoicenumber)>0"}>} DISTINCT invoicenumber)

This in a visualization with AccountName would show average invoices by account where the account has more than 0 invoices