Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating a Measure with Multiple Conditions

Hi,

I'm new to SQL and QlikSense and I am looking to create a new measure/field based on two conditions but I can't seem to get it to work. I'm using it in a sporting environment and want to make a new measure called 'Successful Forward Pass'. I have two measures called 'Pass Outcome' and 'Pass Direction' already and I've tried IF statements like:

if(Count(DIRECTION)='Forward' and Count([PASS OUTCOME])= 'Successful' as 'Successful Forward Pass'))

Basically if the pass is forward and successful. Any help would be greatly appreciated.

Thanks

1 Solution

Accepted Solutions
ogster1974
Partner - Master II
Partner - Master II

To filter, group etc. in Qlik products you need to get familiar with Set Analysis.  Please find attached a document I found useful when I first started out and still refer back to.

View solution in original post

5 Replies
rwunderlich
MVP
MVP

It would be:

count( if(DIRECTION='Forward' AND [PASS OUTCOME]='Successful') )

-Rob

MK_QSL
MVP
MVP

Try without COUNT... only IF(Direction = 'Forward' and If([Pass Outcome] = 'Successful', 'Successful Forward Pass'))

Change Field name as per case sensitive

Anonymous
Not applicable
Author

Count() will return a number...How you can compare it with 'Forward' or 'Success'???

ogster1974
Partner - Master II
Partner - Master II

To filter, group etc. in Qlik products you need to get familiar with Set Analysis.  Please find attached a document I found useful when I first started out and still refer back to.

Not applicable
Author

I managed to figure it out eventually through much trying. The fields for 'Pass Outcome' and 'Pass Direction' were created by merging separate fields from delimited data...

'Pass Outcome:Successful' 'Pass Outcome:Unsuccessful' = Pass Outcome for example. Instead of merging them I left them as separate fields and used this formula:

sum([Direction:Forward] / [Pass Outcome:Successful])

If I'm honest it seems quite illogical but I've checked the data and it's absolutely correct. I initially tried 'and' instead of '/' and realised the numbers were correct but obviously negatives (e.g. -109 instead of 109). Bear in mind I'm completely new to SQL and I'm essentially teaching myself.

@Andy Weir thanks for the reply I will definitely take a look at set analysis. Many thanks for the replies.