Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula Help please! Post Reply Post New Topic
Author Message
iankerry999
Newbie
Newbie


Joined: 31 Jul 2013
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote iankerry999 Replybullet Topic: Formula Help please!
     Posted: 04 May 2014 at 5:49am
Can anyone help?

I am trying to group my data in financial year, and then create a label that says which financial year it is e.g. 13-14, or 14-15.

So I have two formulas:

@FinYr

If Month({feedback.dbo_EventsLive.event date}) >= 4 then
Year ({feedback.dbo_EventsLive.event date})+1 else
Year ({feedback.dbo_EventsLive.event date})

Then a formula @FYformat

{@FinYr}-1 & " - " & {@FinYr};

totext ({@FinYr},0,"")


As a newbie, I think I must be missing something, as the code doesn't produce the results I need.

Anyone help?

Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 May 2014 at 4:18am
 
your -1 is subtracting one day
if you are gouping just consider moving the date backwards 4 months then you can use the regular year for grouping.
 
dateadd("m",-4,{feedback.dbo_EventsLive.event date})
 
you can still display the original date field just group on the shifted date
 
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 05 May 2014 at 7:31am
try

totext({@FinYr}-1,0,"") + " - " + totext ({@FinYr},0,"")

for
formula @FYformat
IP IP Logged
iankerry999
Newbie
Newbie


Joined: 31 Jul 2013
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote iankerry999 Replybullet Posted: 05 May 2014 at 10:06pm
That works perfectly, thanks Kostya.

Doing it all in one line, wasn't something I would have thought of.

There doesn't seem to be a way of having the labels in my barchart to show this field? Is that correct?

Thanks Again.

Ian
IP IP Logged
iankerry999
Newbie
Newbie


Joined: 31 Jul 2013
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote iankerry999 Replybullet Posted: 05 May 2014 at 10:10pm
Thanks Dblank - I am pretty sure that the -1 was taking 1 year off - I was getting the right number 2012.00 - 2013.00, just couldn't get the formatting right.

But thanks for replying.

Ian
IP IP Logged
iankerry999
Newbie
Newbie


Joined: 31 Jul 2013
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote iankerry999 Replybullet Posted: 07 May 2014 at 3:15am
Hi

solved my bar chart problem. Obviously (!) I needed to amend the Chart Expert data field to reflect the FYFormat field.

Thanks for all your help.

Ian
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