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

Count distinct?

I have the following data and as can be seen there is one row for each question, each of these rows have the same (assignment)number.

How can I count how many different (assignment)numbers I have? Right now when I count I get 13 times as many as I would like as the (assignment) number appears 13 times for each questionaire.

Thanks!

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

try this Count(DISTINCT number)

View solution in original post

13 Replies
Anonymous
Not applicable
Author

try this Count(DISTINCT number)

sunny_talwar

May be this:

Count(DISTINCT question)

ishanbhatt
Creator II
Creator II

Hi Madeleine,

It Seems you want only distinct values of the umber column.

Use below expression in measure.

= Count( Distinct  number).

As per Above images this expression will give result 2.

Anonymous
Not applicable
Author

I tried Count (DISTINCT number) but it gives me the total number of (assignment)numbers as it is connected to another table (Assignment) with all assignment(numbers).

Is there any way to calculate only those in a special qvd file (QualityReportAnswer)?

In my qvd files I have renamed the field numbers to AnswerAA.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You can do one thing, the table from where you need the Count, you can add one more dummy field like

Load *,'ABC' as Source

From xyz;

Now in expression you can use the set analysis to get the count only from that table like below.

Count({<Source = {"ABC"}>} distinct Number)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
inoruoya
Partner - Contributor III
Partner - Contributor III

you should add another name field from AnswerAA

ex: 1 as AnswerAACount,

and you can count(AnswerAACount) or sum(AnswerAACount)

try this.

ToniKautto
Employee
Employee

Perhaps the count on the key field questions is causing you to include too many items, as it would count over all linked tables. Try counting on a non-key field, for example Count(DISTINCT QuestionName) with the assumption that QuestionName is an unique as your question number.

Anonymous
Not applicable
Author

I could get your suggestion to work Kaushik Solanki, or yours either Toni Kautto.

However I tried to add a duplicate of my filed numbers that isn't connected to any other table. This one I used in a count instead, this worked.

sunny_talwar

So which field did you end up using to do the count here? and if possible briefly describe why do you think it worked for you and if you have got what you wanted, please close the thread by marking your own response as correct.

Best,

Sunny