# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Contributor

## 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
Contributor II

## Re: Count distinct?

try this Count(DISTINCT number)

13 Replies
Contributor II

## Re: Count distinct?

try this Count(DISTINCT number)

MVP

## Re: Count distinct?

May be this:

Count(DISTINCT question)

Contributor II

## Re: Count distinct?

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.

Contributor

## Re: Count distinct?

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.

## Re: Count distinct?

Hi,

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

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

New Contributor III

try this.

Employee

## Re: Count distinct?

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.

Contributor

## Re: Count distinct?

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.

MVP

## Re: Count distinct?

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

Community Browser