Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

hsm12345
New Contributor

count distinct

I have a set of data with the following info:

MEM#, FV_GROUP

123      FV

456      FV

753      NFV

963      FV

456      FV

769      NFV

I like to get a distinct count of the MEM#.

The result, I like to see is

FV has a count of 3

NFV has a count of 2

The expression I have right now is

=count(distinct(MEM#))

How can change the expression so that I can check the FV_GROUP.

Thanks.       

6 Replies
deepakk
Valued Contributor III

Re: count distinct

Hi,

Is this what you are looking for . PFA

hsm12345
New Contributor

count distinct

Hi,

Can you please post the code? I only have the desktop version so I cannot view the qvw. Thanks.

deepakk
Valued Contributor III

Re: count distinct

hi,

You have written the correct code. Just add it in expression of a chart and add the FV_Group as dimension.

hsm12345
New Contributor

count distinct

Here is my expresssion

Count(${< FV_GROUP = {‘FV’}>} DISTINCT MEM#)

but I am not getting any result. Just a -

What am i doing wrong.

Thanks.

nagaiank
Valued Contributor III

count distinct

If you want to calculate this in a chart, you may use the following chart expression:

Count(DISTINCT TOTAL <FV_GROUP> MEM#)

If you want add this as a field in the script, use the following script:

T1:

LOAD *, RowNo() as ID;

LOAD * Inline [

MEM#,FV_GROUP

123,FV

456,FV

753,NFV

963,FV

456,FV

769,NFV

];

T2:

LOAD FV_GROUP, Count(DISTINCT MEM#) as Cnt Resident T1 Group By FV_GROUP;

Left Join (T1) LOAD FV_GROUP, Cnt Resident T2;

DROP Table T2;

deepakk
Valued Contributor III

Re: count distinct

hi,

The dollar should be inside the bracket.

count({$<FV_GROUP={'FV'}>} distinct MEM#)

Deepak

Community Browser