Need values returned from previous month-end date

1k Views Asked by At

Can someone please guide me as to how this would be done. I'm using Crystal 2008.

I want to pull in data for the previous month-end and put it in the same row as the current month, so there will be two figure columns: one with the Month-End figures and the other will be Previous Month-End Figures. I want it to look like this:

Month-End       Account     Figure      Prev Month-End Figure
1/31/2014       21A3233     11      
2/28/2014       3285592     22          11
3/31/2014       64EG544     33          22
4/30/2014       E5VG96A     44          33
5/31/2014       POIUE52     55          44
6/30/2014       8889947     66          55
7/31/2014       P645252     77          66
8/31/2014       05EU6AB     88          77
9/30/2014       888E658     99          88

How would I get the Prev Month-End Figures based on the Month-End dates in the first column?

1

There are 1 best solutions below

9
On

Create a formula @Last Day and write below code to get last day of previous month:

DateSerial(year({Month-End }),Month({Month-End }),1)-1

Now create a one more formula @Data to get the data of the last day of previous month:

if ({Month-End }=DateSerial(year({Month-End }),Month({Month-End }),1)-1)
then Figure

Place the formula @Data at the column Prev Month-End Figure