Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Kat92
Contributor III
Contributor III

If statement based on filter selection

I want to show the number 6 if column Team= Team1 or Team2 or both and 7 if not.

How can I calculate that in set analysis?

I have tried the below and it works for Team1 or Team2 but not when both are selected

 

if(WildMatch(TEAM, 'Team1', 'Team2'), 6, 7)

Thanks in advance

Labels (3)
1 Solution

Accepted Solutions
vincent_ardiet_
Specialist
Specialist

Like this?
7+(Count({<TEAM*=e({<TEAM={'Team1','Team2'}>}TEAM)>}TEAM)=0)

View solution in original post

9 Replies
mruehl
Partner - Specialist
Partner - Specialist

The problem is the selection of two values, not the formula itself.

Try:

IF(

MATCH(CONCAT( DISTINCT '|'&TEAM&'|'), '|Team1|', '|Team2|')

, 6, 7)

 

Kat92
Contributor III
Contributor III
Author

Hi,

 

Thank you for the above suggestion, however I tried and when both are selected Team1 and Team2 it does not show the value 6 but again 7.

Aasir
Creator III
Creator III

if(Count({<TEAM = {'Team1', 'Team2'}>} distinct TEAM) > 0,6,7)

Kat92
Contributor III
Contributor III
Author

This works, however it returns 6 also for the rest of the teams. So, 2 of the teams and their combinations need to return 6 while the rest 6 teams and any of their combinations should return 7

Aasir
Creator III
Creator III

My bad, try this 
if(WildMatch(TEAM, 'Team1', 'Team2') or WildMatch(TEAM, 'Team1|Team2'),6,7)

Kat92
Contributor III
Contributor III
Author

It seems that 'Team1|Team2' is not recognized.

Is there maybe any update or other symbol to be used?

 

vincent_ardiet_
Specialist
Specialist

Like this?
7+(Count({<TEAM*=e({<TEAM={'Team1','Team2'}>}TEAM)>}TEAM)=0)

Kat92
Contributor III
Contributor III
Author

Yes, this works perfectly.

Thank you very much!

Aasir
Creator III
Creator III

if(WildMatch(TEAM, 'Team1') or WildMatch(TEAM, 'Team2') or WildMatch(TEAM, 'Team1*Team2'),6,7)