Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
rds694
Contributor
Contributor

Percentages by flexible group

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.

ryandsimpson94_7-1651677439357.png

 

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:

ryandsimpson94_2-1651677144369.png

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.

ryandsimpson94_4-1651677280396.png

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.

ryandsimpson94_6-1651677378850.png

Any thoughts on these issues I'm having? I just don't understand what I'm doing wrong!

 

Labels (5)
12 Replies
gp_oconnor
Partner - Contributor III
Partner - Contributor III

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.

rds694
Contributor
Contributor
Author

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:

rds694_0-1652287062004.png

 

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.

rds694_1-1652287161924.png

 

 

gp_oconnor
Partner - Contributor III
Partner - Contributor III

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.