Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: formula/manual cross tab help Post Reply Post New Topic
Author Message
bryonwoods
Newbie
Newbie


Joined: 15 Feb 2011
Online Status: Offline
Posts: 16
Quote bryonwoods Replybullet Topic: formula/manual cross tab help
     Posted: 07 Mar 2011 at 8:10am
my variable name in my database is rsq01. the results for this variable are 0,1,2,3,4,5.
I need to setup a crosstab that only shows the results 1-5 and what percent of the total results they are, 0 needs to be excluded
from the crosstab and from the count that is used in figuring the percentage because 0 is actually null.
I have been told to do this I will have to make a manual cross tab using formulas.
Any suggestions/examples on how to do this? Thanks.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Mar 2011 at 8:16am
if you exclude the 0 values from the report you can just insert a regular ct and do counts on the values and also set that up as showing % of the total count.
If not you can use 6 running total to get your values and 5 formula to get the % and place them int he reprot footer.


Edited by DBlank - 07 Mar 2011 at 8:17am
IP IP Logged
bryonwoods
Newbie
Newbie


Joined: 15 Feb 2011
Online Status: Offline
Posts: 16
Quote bryonwoods Replybullet Posted: 08 Mar 2011 at 5:43am
thanks, how do i tell it to exclude 0 values from the report?
my database actually have 18 questions that I need to make manual crosstabs for and not use the 0 values from any of them, so if i could tell it to exclude 0 values that would be great.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Mar 2011 at 5:47am
Are your 18 questions set as 18 columns in your db or are the sdet as rows with a question identifier in the row?
IP IP Logged
bryonwoods
Newbie
Newbie


Joined: 15 Feb 2011
Online Status: Offline
Posts: 16
Quote bryonwoods Replybullet Posted: 08 Mar 2011 at 5:59am
the 18 questions are in columns labeled rsq01, rsq02 etc. i need a separate cross tab for each question that excludes the 0 values in the count for the % values. I also need for all the crosstabs to show 1-5 in the columns even if 2 wasn't a result for that question, which is where i was told i would have to do a manual crosstab.
there is no unique key in the database, the first column of the database is a store id which is being grouped on so that each page of the form is a separate store that will have 18 crosstabs showing the % results for just that store.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Mar 2011 at 6:31am
You won't be able to exclude zeros using the select statement as each row might have a zero for one column but a non zero in another.
 
So your customer realizes that the N will likely change per question for each store. Nor will they know how may instances per question that it was not answered (=0).
You will haev to make a billion and 1 running totals to get your data with no zeros. If you can talke them into seeing the value in that information it will make the report 100% easier.
If not...
for each question you will need 6 RTs to get your amounts and 5 formula field to get your %.
Maybe there is an easier way but I am not seeing it at this time.
Build it out for Q1 and make sure it works and is what they want before you build it all the way. (I would also consider showing them a version of including the 0s to show them what them an alternative)
RT examples for q1
Name= Q1_all
field to summarize=rsq01
type = count
evaluate=use a formula
table.rsq01 <> 0
reset=on change of group (select store id group)
place in group footer
This gives you your count of all records with no 0 for q1
 
Next make 5 rts, 1 per possible answer
name = Q1_1
field to summarize=rsq01
type = count
evaluate=use a formula
table.rsq01 = 1
reset=on change of group (select store id group)
place ion group footer
counts only anser of 1
 
next
name = Q1_2
field to summarize=rsq01
type = count
evaluate=use a formula
table.rsq01 = 2
reset=on change of group (select store id group)
place ion group footer
counts only anser of 2
 
repeat for all the other values (3-5)
 
place all in group footer
to get % make 5 formula field
q1 value 1 as {#Q1_1}% {#Q1_all}
q1 value 2 as {#Q1_2}% {#Q1_all}
q1 value 3 as {#Q1_3}% {#Q1_all}
q1 value 4 as {#Q1_4}% {#Q1_all}
q1 value 5 as {#Q1_5}% {#Q1_all}
 
 
IP IP Logged
bryonwoods
Newbie
Newbie


Joined: 15 Feb 2011
Online Status: Offline
Posts: 16
Quote bryonwoods Replybullet Posted: 08 Mar 2011 at 6:59am
thanks very much dblank. i'll start in on using what you've suggested. I have a couple crystal reports books and have watched numerous videos, but this is my first report and of course it would be alot more complex than most books/videos go into.
I will have to do all the running totals because we have to exclude the 0's, because the 0 values will deflate the means for each question. but the good news is once i have this all setup, it's done as we have hundreds of these to run against the one report setup.
Thanks again for your help.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum