Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Multiple If in Expression

I have the following Example data

ExcelData.JPG

I need to find Number of Users who never used Card but used only Key.

I set Dimension as Country

For Expression I have used the following.

Count (DISTINCT(If  (CardUsageCount=0, (If (KeyUsageCount>0, UserID)) )))

I am supposed to get results as follows

Country                  No Of Key Users wo never used card

GERMANY                    1

North. AMERICA             0

BULGARIA                    0

Bulgeria should not be counted because  the user has used card in August.In my result it is counted.

Where am I making mistake?

Thanks

Tags (4)
1 Solution

Accepted Solutions
Not applicable

Multiple If in Expression

Thanks for the help. 

4 Replies
MVP
MVP

Multiple If in Expression

I believe your if() statement is evaluated per record and you have two records for bulgaria, one of it results in a true condition and thus you get a count for bulgaria.

Try this instead:

=Count(distinct aggr(If  (sum(CardUsage)=0 and sum(KeyUsage)>0, UserID),UserID))

this aggregates CardUsage and KeyUsage per userID over all Month ("never used Cards, ever used Keys") and returns appropriate UserIDs.

Hope this helps,

Stefan

Not applicable

Multiple If in Expression

Thanks for the help. 

Luminary
Luminary

Multiple If in Expression

Please can you mark the right answer as "Correct Answer"? It will be good for other users to see the correct answer.

Thanks - DV

Not applicable

Multiple If in Expression

Please mark the answer as correct, not your own comment ;-). Enjoy the day!

Community Browser