Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to calculate percentages on next line 1

Status
Not open for further replies.

timotech01

Programmer
Aug 25, 2010
6
Hi All, I have a problem calculating percentages for my data

I have a set of data that are represented in this format:

Etisalat
Media May June

TV Total 566484 687585

Radio Total 273848 734849


GlobaCom
Media May June

TV Total 373644 675738

Radio Total 172736 436487


how can i format my report to achieve something like this:


Etisalat
Media May June

TV Total 566484 687585

60% 53%

Radio Total 273848 734849

70% 80%


GlobaCom
Media May June

TV Total 373644 675738

40% 47%

Radio Total 172736 436487

30% 20%

Etisalat and Globacom are Group headers coming from this field {stp_GetShareOfVoiceReportByValue_sel;1.Brand}

I wrote this formular:
if {stp_GetShareOfVoiceReportByValue_sel;1.Medium} = "TV Total" then
{stp_GetShareOfVoiceReportByValue_sel;1.May}/Sum ({stp_GetShareOfVoiceReportByValue_sel;1.May}) * 100
else if {stp_GetShareOfVoiceReportByValue_sel;1.Medium} = "Radio Total" then
{stp_GetShareOfVoiceReportByValue_sel;1.May}/Sum ({stp_GetShareOfVoiceReportByValue_sel;1.May}) * 100

but it only gets the wrong percentages

Please what can i do

Thanks

Timotech
 
You don't say what it's a percentage of. That makes it hard to give specific advice.

In general terms, you need to group by 'Media', so that TV and Radio are separate, though probably part of some larger group.

Use either summary totals or running totals, depending on what you're after. A summary total can be used anywhere, while a running total for a group will only be valid in the group total.

You probably need a formula field to work out the percentages from the automatic totals.

The use of Crystal's automated totals is outlined at FAQ767-6524.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
You need to add another group ie Media

Then in group footer

add formula

@May

sum({stp_GetShareOfVoiceReportByValue_sel;1.May}, {MediaField})/Sum ({stp_GetShareOfVoiceReportByValue_sel;1.May}) * 100

Ian
 
Create a formula {@TVMay}:

if {stp_GetShareOfVoiceReportByValue_sel;1.Medium} = "TV Total" then
{stp_GetShareOfVoiceReportByValue_sel;1.May}

For your percentage, use:

{@TVMay} % sum({@TVMay})

Repeat for {@TVJune},{@RadioMay}, and {@RadioJune}.

-LB
 
Hi MadawC and IanWaterMan, thanks for your replies, i tried them, but i did not quite get the right percentages, i noticed that the sum{stp_GetShareOfVoiceReportByValue_sel;1.May} was getting the sum for both tv totals and radio totals, but how do we now separate their totals, because, i tried the grouping by {stp_GetShareOfVoiceReportByValue_sel;1.Medium} and i still got the same results as before.

Hi Ibass, please i need more enlightenment on your post
Thanks so much

Timotech
 
Hi Ibass, at first i did not understand your post, but after going through it again, i found out that you were very right, i applied it and it worked perfectly. Thanks and Thanks to every body too.

Timotech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top