Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trouble with count DISTINCT

I'm bumbling my way through using expressions as measures for bar charts, and so far I have the following working expression, which counts people based on specific values for two different fields:

count({$<[Past Rank]={"MS","PhD"}, [Role]={"Camper"}>} [Past Rank])

The source data (uploaded from an xls file) contains multiple lines per person, so now I'm trying to figure out how to adjust the expression shown above so that it only counts each person once.  I'm guessing that I need to somehow specify that the count should look at the [Person ID] field and use the word DISTINCT.  However, I'm at a loss as to how to do that.

My attempt below does NOT work:

count({$<[Past Rank]={"MS","PhD"}, [Role]={"Camper"}>} DISTINCT [Person ID])


I'm still fairly new and I'm having trouble figuring out the syntax.


Thanks!


Tom

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

count({$<[Past Rank]={'MS','PhD'}, [Role]={'Camper'}>} DISTINCT [Person ID])


i.e. Single Quote instead of Double ...

View solution in original post

6 Replies
MK_QSL
MVP
MVP

count({$<[Past Rank]={'MS','PhD'}, [Role]={'Camper'}>} DISTINCT [Person ID])


i.e. Single Quote instead of Double ...

maxgro
MVP
MVP

the syntax of your expression seems correct, could you post the excel source file or the .qvw?

Not applicable
Author

Thanks Manish - what do single vs. double quotes mean in the expression?

Not applicable
Author

Actually, I think I found the answer here: QlikView Quoteology

"Single quotes are used to quote literals, e.g. strings that should be used as field values."

MK_QSL
MVP
MVP

QlikView Quoteology

Oh... I am late..

maxgro
MVP
MVP

Thomas (and Manish too): It should be as you said

but in set analysis (today, see Henric ... in the same post) single or double quotes doesn't matter

and also it works without quotes (if you don't have spaces); this is from QlikView online help

sum( {$<Year = {2000}, Region = {US, SE, DE, UK, FR}>} Sales )

this is the reason I asked for the excel source file