Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Hal43210
Contributor II
Contributor II

Showing results based on dimension

I'm guessing there's an easy solution to this....

Assume I have survey results showing who owns what kitchen items, e.g. in the table below a 1 is Yes:

Item

Respondent

YesNo

Pots

John

1

Pots

Sue

1

Pots

Alan

1

Pans

John

0

Pans

Sue

0

Pans

Alan

1

Forks

John

1

Forks

Sue

0

Forks

Alan

1

Spoons

John

0

Spoons

Sue

1

Spoons

Alan

0

Salt

John

0

Salt

Sue

0

Salt

Alan

1

Pepper

John

1

Pepper

Sue

0

Pepper

Alan

0

 

Next I create a bar chart with dimension Item vs sum(YesNo).

Now suppose I create a dropdown where the user can select an Item, and I now want the bar chart to show the same distribution of sum(YesNo) for each Item, but only for those who responded Yes to owning the Selection in the drop dropdown.  In other words, if Fork is selected in the dropdown, the chart would show the distribution of all Items owned by John and Alan (who own forks).  How would I implement that?  

I created a dropdown to populate a variable vItem, but wasn't sure how to use that in a bar chart expression.  Or should I be using an entirely different approach?

 

1 Solution

Accepted Solutions
Vegar
MVP
MVP

I overlooked the fact that the P(Respondent) would include Sue, hence we have the zero values. Ajust your expression to this:

Sum({<Item=,Respondent=P({<YesNo={1}>}Respondent)>}YesNo)

Vegar_0-1635101573979.png

 

View solution in original post

4 Replies
Vegar
MVP
MVP

You can solve this by using indirect set analysis .

I would assume something like this will get you what you want.

Sum{<Item=,Respondent=P(Respondent)>}YesNo)

... maybe even the simpler version below will do it.

Sum{<Item=,Respondent=Respondent>}YesNo)

Hal43210
Contributor II
Contributor II
Author

Vegar,

Thank you for that suggestion.  I am not quite certain as to how to implement it properly.

So the basic bar chart looks like this:

 bar1.PNG

Then I'd like for the user to be able to pick an item. such as Forks (either with a dropdown setting a variable, or a standard filter list for Items, or by clicking on a bar chart bar itself):

 item.PNG

And in this case, because only Alan and John have forks, the original bar chart updates (or it can be a separate bar chart) to show all of the items owned by only Alan or John:

bar2.PNG

Using Sum({<Item=,Respondent=P(Respondent)>}YesNo) or Sum({<Item=,Respondent=Respondent>}YesNo) for the bar measure expression doesn't seem to achieve this.  Could you possibly suggest a specific expression that would work here?

Thank you

Vegar
MVP
MVP

I overlooked the fact that the P(Respondent) would include Sue, hence we have the zero values. Ajust your expression to this:

Sum({<Item=,Respondent=P({<YesNo={1}>}Respondent)>}YesNo)

Vegar_0-1635101573979.png

 

Hal43210
Contributor II
Contributor II
Author

Perfect!  Thank you!