Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula Help Post Reply Post New Topic
Author Message
AMJacks
Newbie
Newbie
Avatar

Joined: 27 Oct 2009
Location: United States
Online Status: Offline
Posts: 3
Quote AMJacks Replybullet Topic: Formula Help
    Posted: 17 Mar 2010 at 7:03am
I have a query in SQL 2005 that I want to convert to a formula. Here is my query:

declare @todays as datetime

set @todays ='02/15/2010'

select DatePayment , sum(dollarsunallocated)

from VWr_Insurance_Payment

where dollarsunallocated >0

and datepayment >= (@todays -30)

group by datepayment,payorname

 
I created this formula
if date ({TPr_InsPayments;1.DatePayment}) in {?@todate} - {?Period A} to {?@todate}
then Sum ({TPr_InsPayments;1.DollarsUnallocated},{@Group - Payor Name} )
else 0
 
but it is not working correctly
 
can anyone help me with this?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Mar 2010 at 11:44am
you can break this into 2 parts, the first to get the amounts then the seecond as the sum. I think you were trying to use 2 params, one as a end date and the other as a total # of days...
if date ({TPr_InsPayments;1.DatePayment}) in dateadd('d',{?Period A},{?@todate} to {?@todate} and {TPr_InsPayments;1.DollarsUnallocated}>0 then ({TPr_InsPayments;1.DollarsUnallocated} else 0
Now you can insert the SUm of that formula at any group level you want
SUM(@formula, groupfield)
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.033 seconds.