Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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)
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)
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:
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):
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:
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
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)
Perfect! Thank you!