Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: formula for dynamic column Post Reply Post New Topic
Author Message
pratibha
Newbie
Newbie


Joined: 05 Jan 2012
Location: India
Online Status: Offline
Posts: 1
Quote pratibha Replybullet Topic: formula for dynamic column
     Posted: 05 Jan 2012 at 12:12pm
Hello friends !!!

my question is -
what i need in reports-- on dynamic columns for peroid 2009-10, 2010-11 ,so on.. my summary fields are col1, col2 for each period. and on grand total , i want to use formula so row grand total for col1 needs formula like              
in period 2010 (col1) + in period 2009 (col1), in period 2010(col2)+ in period 2009 (col2) like this... means if period like 2005,2006,2007 then i want formula for last year 2007 & previous year 2006.

How to do this in crystal reports in cross tab or else ???
exactly looks like below :

     --this year is dynamic columns
     2009        2010            %changeA      %change B
---------------------------------------------------------     
       A2 B2      A3    B3   (A3-A2)/A2     (B3-B2)/B2
---------------------------------------------------------
dataX 2   1       5     8       1.5               7
dataY 4   5       5     6       0.25              0.2
dataZ 4   2       9     8       1.25              3
--------------------------------------------------------



plz reply..

Edited by pratibha - 05 Jan 2012 at 1:01pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 Jan 2012 at 8:44am
well cross tabs will get the dynamic columns, I don't know about the % changes...I don't use cross tabs (clients don't ask for them).
 
you could probably do this in a stored procedure, use constant names for the columns and put the names you want to display for each column in a field in the row (or in a linked table that the stored proc returns as well)
 
HTH
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 06 Jan 2012 at 8:55am
just create a formula for each field  like
A2
if table.datefield in date(2009,1,1) to date(2009,12,31) then table.field_you need to summerize

A3
if table.datefield in date(2010,1,1) to date(2010,12,31) then table.field_you need to summerize

etc

your  %changeA    would be just like you wrote it (A3-A2)/A2

then just put them into your crosstab


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