Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

marley1978
New Contributor II

Counts Showing Incorrectly in charts

I have a measure where I use an expression of

Count ({< [Term] = {'Yes'}, [Term Reason] -= {'Unknown'}>} EmployeeID)

When I use this in a pivot table and group by YearMonth I get a total of 791 records which is correct.

When I use the same expression in a KPI I get 784 records.  Looks like its removing duplicate employeeIDs.  Duplicate records can occur since an employee can be termed more than once in a given period.

I am not sure what is going on since I am using the same master measure in both types of charts.

Any ideas why it would do this?

21 Replies
MVP
MVP

Re: Counts Showing Incorrectly in charts

Are you sure that you are not using DISTINCT in the expression by any chance?

marley1978
New Contributor II

Re: Counts Showing Incorrectly in charts

I am not.  That is why I am confused.   The expression is exactly as I have in my post.

MVP
MVP

Re: Counts Showing Incorrectly in charts

What happens when you use this as a measure directly in the chart rather than using it as a master measure? Does it still behave the same way?

omarbensalem
Esteemed Contributor

Re: Counts Showing Incorrectly in charts

What happens if u use :

if([Term] = {'Yes'} and[Term Reason] <> {'Unknown'},Count ( EmployeeID) )

marley1978
New Contributor II

Re: Counts Showing Incorrectly in charts

how do I do that?

MVP
MVP

Re: Counts Showing Incorrectly in charts

Wherever you are using the master measure, can't you really replace that with the measure itself? I am new to Qlik Sense, so don't really know how it works... but may be omarbensalem‌ might be able to help better on this

marley1978
New Contributor II

Re: Counts Showing Incorrectly in charts

I copied that and it says there is an error in the expression

')' is expected

marley1978
New Contributor II

Re: Counts Showing Incorrectly in charts

I added the measure without using the master item and same results

MVP
MVP

Re: Counts Showing Incorrectly in charts

One way to resolve this would be to try this

Sum(Aggr(Count ({< [Term] = {'Yes'}, [Term Reason] -= {'Unknown'}>} EmployeeID), YearMonth))

but even it works, that would still not explain why it doesn't work in the first place