Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Fetching crosstab column subtotal Post Reply Post New Topic
Author Message
kunaljvora
Newbie
Newbie


Joined: 26 Sep 2011
Online Status: Offline
Posts: 1
Quote kunaljvora Replybullet Topic: Fetching crosstab column subtotal
     Posted: 26 Sep 2011 at 12:19am
Hi,

I have an issue in fetching the crosstab generated subtotal column in a formula field based on groups. Please allow me to explain where I am stuck.

I am having product wise sales belonging to a group over 5 years, wherein the years are shown horizontally (monthwise and then grouped by year) and the products vertically, grouped by another field in the cross tab.

I have to display the annual summary for each products vertically. The Annual summary column is basically a subtotal generated by cross tab which you can suppress from the cross tab expert. (Subtotal for @yeargroup)

My issue is for Group 1, I have to show the AVERAGE of the annual sales, and for group 2, the TOTAL of the annual sales (in the same crosstab generated subtotal column for @yeargroup).

I can write a logic in the "Display String" formula field of the the same, but I am unable to fetch the required grouped series as a field.

e.g. Display string formula field crystal syntax for the subtotal in the crosstab:

Local Varchar newsales;
Local Varchar total;
Local Varchar avg;

newsales:= currentfieldvalue; // I want currentfield here instead of the currentfieldvalue
total:= sum(newvalues);
avg:=average(newvalues);

If (condition) then
totext(total)
else
totext(avg)


The above doesnt work (obviously) since crystal seeks a field for newvalues, instead of currentfieldvalue. But I dont know how to fetch the field which is a cross tab generated column and not something coming from the database. I can do total:= newvalues + 100; etc but I need a sum/average of the series grouped in the crosstab

Thanks in advance,

Kunal
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