
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Suggest Alternative to an If Statement
I understand that If Statements are big no nos in Qlikview.
I have a decent understanding of Set Analysis. My current requirement is to only calculate a value when a single value is selected for the the Store.
=if(GetSelectedCount(Store)=1,'Dogs:'&Count({$<PetType={'Dog'}>} Distinct PetID),'Select a Store')
I am sure this has been answered a few times, please feel free to direct me to an answer. I searched a few ways. I have seen a solution that uses pick match, but I am not sure if that solution applies in this situation.
Thanks in advance
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is Pick() way to do this
=Pick((GetSelectedCount(Store)=1)+2,'Dogs:'&Count({$<PetType={'Dog'}>} Distinct PetID),'Select a Store')


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What are you expecting to see in your text boxes?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am expecting to see what is there.
I am being told if statements are an absolute no and can not be used due to performance issues. I am just wondering what the alternatives are.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is Pick() way to do this
=Pick((GetSelectedCount(Store)=1)+2,'Dogs:'&Count({$<PetType={'Dog'}>} Distinct PetID),'Select a Store')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your sample file attached


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try with :
=pick(match(GetSelectedCount(Store),1)+1,'Dogs:'&Count({$<PetType={'Dog'}>} Distinct PetID),'Select a Store')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks
I was making this a lot harder than it needed to be. I will see if this works in my application and mark this as the correct answer if so. Thanks again.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
