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

If statement and the same attribute value?

Hey everyone,

I am new to Qlikview and now am struggling with a problem.

I have log file value such as:

UserID Component

1             a

1             a

1             b

2             a

2             a

3             a

3             c

3             d

What I would like to do is to count the number of distinct users who have only value "a" in component. In the case above, the number should be 1, since only UserID 2 only has value "a" component, without other value.

Does anyone know how could I write such a formula for counting?

Thanks a lot!

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Try:

=count({<UserID = {"=only(Component)='a'"}>}distinct UserID)

Hope this helps!

View solution in original post

5 Replies
jerem1234
Specialist II
Specialist II

Try:

=count({<UserID = {"=only(Component)='a'"}>}distinct UserID)

Hope this helps!

pgrenier
Partner - Creator III
Partner - Creator III

Hello,

You can achieve this with the following expression:

=Count({<UserID=E({1 <Component={"b", "c", "d"}>})>} DISTINCT UserID)

Please find attached the Only_A.qvw file as an example.

Regards,

Philippe

Not applicable
Author

Hey Jeremiah,

it works! I really appreciate your help

Not applicable
Author

Hey Phillippe,

thanks a lot for your help. Do you also agree that the solution provided by Jeremiah also works?

In the example I only named a few values in Component, if there are many more than those listed, would it not be so convenient to list all values except "a" in your formula?

Best regards,

Jun

pgrenier
Partner - Creator III
Partner - Creator III

I do agree

Thanks for the feedback Jun!

Regards,

Philippe