Answered by:
Percentage of total
Question

User195919916 posted
Hi there,
I have a report:
QuestionGroup Question Answer 1 (10) >nr of persons who answered "Answer 1" Answer 2 (3) Answer 3 (7) Answer 4 (0) Total: 20
 There are 3 groups: QuestionGroup>Question>Answer
 Total is a running total field (count), which resets every question (lets call it totalAnswersPerQuestion)
 Nr of persons who answered a specific question is a running total field (count), which resets every answer
My goal is to show percentage of people who answered specific questions (instead of having Answer 1 (10), heaving Answer 1 (50%)).It would be good to have a formula field like "nrPeoplePerAnswer/totalAnswersPerQuestion*100". However, totalAnswersPerQuestion is calculated progressively, which means that when calculating nrPeoplePerAnswer at Answer 1, totalAnswersPerQuestion is 10 at the moment, which means the result is 100% (10/10*100).Is there any way to do this?Thanks in advance.
MP
Friday, May 31, 2013 12:26 PM
Answers

User195919916 posted
I managed to change the SQL that feeds the report and then used a formula to do what I want:
count({newfield},{group})
 Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, June 4, 2013 12:55 PM
All replies

User851967432 posted
You have a couple of options. You can either handle it in a formula or in your query. Personally, I would handle it in the TSQL and keep the report clean.
Friday, May 31, 2013 2:34 PM 
User195919916 posted
Thank you Adam.
Right now, it's very complicated to handle it from SQL. I tried to use a formula, but the results are not corret. I used somthing like this:
formula=Count({datasetfield},{datasetfieldgroup})
Thank you...
Saturday, June 1, 2013 10:28 AM 
User578610739 posted
Hi Marcopais,
For you issue, create a formula and in that set only the value which you want. like
if(datatable.col1 == 'ABC') then return 1
now in running total you give condition when this variable have value 1, then count . now put on in each group one by one and find out where your goal complete.
Monday, June 3, 2013 12:56 AM 
User195919916 posted
Hi Ajay,
The problem is that, with running totals, I only get the results progressively, like this:
QuestionGroup Question Answer 1 (10) with RT > 10 Answer 2 (3) with RT > 13 Answer 3 (7) with RT > 20 Answer 4 (0) with RT > 20 Total: 20
Next to each answer, I would need the total of the group (question), i.e., 20. With RT, the results are suming as long as the records are being read, it seams.
Thank you.
Monday, June 3, 2013 5:09 AM 
User578610739 posted
Hi Marcopais,
For your issue, make one function as above said, now put into detail section and then give summary or running total. I forget the exact which one is used..
If possible then give screen shot.
Monday, June 3, 2013 5:49 AM 
User195919916 posted
Ok, I think the problem is well documented in the picture below:
https://cloudpt.pt/link/a3d55d442d144a08aaa48b26bd37d81d/print.png
Using the function and then a running total (every answer) to sum the function result, I get the following:
https://cloudpt.pt/link/7e838db7e83f4c90bf500572090fab3f/print2.png
(Sorry the language).
Hope you understand. Thank you.
Monday, June 3, 2013 6:52 AM 
User195919916 posted
Also, I get the same result as picture 2 using the formula:
formula=Count({answer},{questiongroup})
This should count every answers in each question (in this case, 36)... :/
Monday, June 3, 2013 7:01 AM 
User578610739 posted
Hi Marcopais,
just change in your above formula as, use global varialbe for counting.
if {col1}.{tablename} != null or {col1}.{tablename} != "" then
global variable v = v+1;
Now use in there.. I think you are near to your result , some silly mistake happened. I don't have report , other wise I will solved it. Sorry for that.
Monday, June 3, 2013 8:06 AM 
User195919916 posted
First of all, thanks for all your effort. This is killing me...
This is the report: https://cloudpt.pt/link/d17e156d3ef94b499ef2d154943989de/crQUESTAvaliacao.rpt
If you could look at it, I would appreciate. I know that, without data, it's difficult to understand it. Plus, the language does not help..
There are some test formulas (XXX, YYY, ZZZ) and running totals (RTotal0). Every record that needs to be counted is {idCotacao}. Question is grouped by {idPergunta}. So, for each {idPergunta} I would like to count every {idCotacao}...
Thank you once again.
Monday, June 3, 2013 9:20 AM 
User195919916 posted
I managed to change the SQL that feeds the report and then used a formula to do what I want:
count({newfield},{group})
 Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, June 4, 2013 12:55 PM 
User851967432 posted
I managed to change the SQL that feeds the report and then used a formula to do what I want: count({newfield},{group})
Gee that sounds familiar.
Tuesday, June 4, 2013 12:57 PM