Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I do this sort of things with if. Should i use set analysis?

Hi everybody.

For example if i have to do

COUNT DISTINCT (X)

IF STATE = 1

this in qlikview is

if(state=1,count(distinct(x)),)

How i do this with set analysis? what is the best option?

Greetings!

1 Solution

Accepted Solutions
Colin-Albert

This will give you the result you want

     count({$ <state={1}>} distinct X)

View solution in original post

4 Replies
consenit
Partner - Creator II
Partner - Creator II

Hi there.

Try:

COUNT

(

     {$<state={1}>}

     DISTINCT

     X

)

Kind regards,

Ernesto.

Not applicable
Author

Thanks.

I've done this

Count(DISTINCT{<Condition>}X)

Colin-Albert

This will give you the result you want

     count({$ <state={1}>} distinct X)

consenit
Partner - Creator II
Partner - Creator II

It seems the positions of the set expression and the DISTINCT clause are irrelevant. In my tests

=COUNT( DISTINCT {$<state={1}>} x )

is the same as:

=COUNT( {$<state={1}>} DISTINCT x )

Kind regards,

Ernesto.