Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm trying to make a visualization with flexible groupings to analyze survey data, in which the percentages are counted as a portion of the first grouping, not of the overall total. So this is what I'm looking for.
I plan to use variables with user selected parameters to get the groups, but first I wanted to get it to work with fixed dimensions. I've gotten it to work for a single grouping, but flexible grouping is causing me issues. To get the above image I used the following expression:
=Count(GetObjectDimension(1))/Count(Total <[To which of the following age groups do you belong?]> getObjectDimension(1)
Ideally, I'd replace the hard coded <[To which of the following age groups do you belong?]> with something along the lines of <getObjectDimension(0)> but I can't figure out the syntax to make that work.
Also, I've tried using if statements to determine the field grouped on in Group 1, but that seems to mess up the percent by grouping. In the image above (which calculated what I wanted), my Group 1 dimension expression was hard coded as the age group field:
However the moment I add an if statement into the equation in messes up the calculations. For instance, even this following statement, which should return the exact same field causes an issue.
After making this simple change to the Group 1 dimension (which really shouldn't change the results at all), the percentages are no longer at 100% per group, but instead out of every group combined.
Any thoughts on these issues I'm having? I just don't understand what I'm doing wrong!
vQuestion is the question for which you want answers displayed in the chart.
vSurveyDimension is the grouping, in the case of the sample app, Age or Citizenship.
The expression is calculating the % of responses within a question and grouping.
Your app would be using a different data model to the sample app, though the principle should work. If you aren't able to resolve, please upload your app with a sample set of data.
I got this to work for the most part - one question though:
At the bottom of the graph, the label for the group dimension is listed as vSurveyDimension, and is tied to the master dimension. I would like to change the label below the graph to be the survey dimension selected (in the case of your graph, either age of citizenship). However, changing the label name also changes the calculation, making it 100% for the entire graph, not for each dimension.
This first image is how you had it:
This second image is with the label changed. Notice the label at the bottom says "Age" and the percentages add up to 100% for the entire graph.
Hi
The sample solution I provided previously needed two changes:
1. Master item definition for vSurveyDimension needed to have Label expression defined as ='$(vSurveyDimension)'
2. Measure definition for % of Responses needed to be defined as
Count({<[Question]={'$(vQuestion)'}>} [ResponseID])
/
Count({<[Question]={'$(vQuestion)'}>} Total <[Question],[$(vSurveyDimension)]> [ResponseID])
After adjusting the sample app with these two changes, the %s seem to display as required. Updated sample app attached.