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: 
dreweezy
Creator II
Creator II

using the variable buttons to render one chart for multiple measures

I've got a situation where I've got a few buttons listed as :  Team A, Team B, Team C, etc. defined respectively as 1, 2, 3, etc in my variable list.

I would like for this histogram to render the sales based on these teams and I have my syntax as follow.

=if(($(vTeam)= 1, [Days in Team A]), if($(vTeam) = 2, [Days in Team B]),  if($(vTeam) = 3, [Days in Team C]))

I have done it this syntax by just one team and it works fine. Once I incorporate the other 3 if statements to render the chart it doesn't read it properly. Can someone please guide me on what I am doing incorrectly here. Thank you.

Labels (1)
1 Solution

Accepted Solutions
rubenmarin
MVP
MVP

Hi, parenthesys are closing if, the nest ifs you can use the second parameter of If(): If(condition, true, false)
=if($(vTeam)= 1, [Days in Team A], if($(vTeam) = 2, [Days in Team B], if($(vTeam) = 3, [Days in Team C])))

Also you can use Pick():
Pick($(vTeam)
,[Days in Team A]
,[Days in Team B]
,[Days in Team C]
)

View solution in original post

2 Replies
rubenmarin
MVP
MVP

Hi, parenthesys are closing if, the nest ifs you can use the second parameter of If(): If(condition, true, false)
=if($(vTeam)= 1, [Days in Team A], if($(vTeam) = 2, [Days in Team B], if($(vTeam) = 3, [Days in Team C])))

Also you can use Pick():
Pick($(vTeam)
,[Days in Team A]
,[Days in Team B]
,[Days in Team C]
)
dreweezy
Creator II
Creator II
Author

Awesome! I was able to get the nested ifs to work as well as the solution you provided!