Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a cross tab like this
		Gulberg Off			SWG					
		IN	Out	Total	IN	Out	Total			
1/1/1900	0.00	0.00	0.00	20.00	0.00	20.00			
7/3/2013	0.00	0.00	0.00	0.00	-1.00	19.00			
7/8/2013	0.00	-2.00	-2.00	0.00	0.00	0.00			
7/12/2013	10.00	0.00	8.00	0.00	0.00	0.00			
7/13/2013	0.00	-1.00	7.00	0.00	0.00	0.00			
7/16/2013	0.00	0.00	0.00	0.00	-10.00	9.00			
7/27/2013	0.00	-1.00	6.00	0.00	0.00	0.00			
7/29/2013	0.00	-4.00	2.00	0.00	0.00	0.00			
7/30/2013	0.00	0.00	0.00	0.00	-1.00	8.00		

What I want is to forward the previous total value to the next Row having Zero in the "IN" and "Out" Columns.
For example in 7/16/2013 row Under the "Gulberg Off" the total values are zero but I want to show the Previous total value in this row as Total which is 7.00
How can I achieve this ?
How can I get the Previous value in the cross tab to use it in the next row in the same column?
Posted
Updated 22-Mar-14 6:32am
v2

1 solution

Use the derived field something like the below query

(select top 1 total from table1 where mydate < '7/16/2013' and field2 = 'Gulberg off'
order by mydate desc) as 'Prev total'


Hope this helps!!
 
Share this answer
 
Comments
WaseemAmin 24-Mar-14 6:51am    
Thank you sir ,
but I have a very long query as a stored procedure and I want to do it in the Crystal Report Cross Tab. Is there any technique for this like using some formula to get previous value in the cross tab of Crystal Report or using any structural method in the Crystal Report?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900