Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to look at data a year back

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2013-12-02 : 18:35:57
This formula "

if {ICDET76.ITTRND}>= {?S1 From Date} and {ICDET76.ITTRND}<={?S1 To Date} then

s1qty:= s1qty + {ICDET76.ITQTY#}; "



shows the qty used for an item corresponding to the month param entered.



In a new report, I need to show what was qty used for the item, but one year ago from that param date. What would be the way to calculate, in this formula. Param will stay the same. The user will enter 092013 and we want to show data for 092012, using above query which does work. just need to subtract a year. I tried sub 365 but this does not work.

which i would use in the new report?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-03 : 00:24:07
is this sqlserver? I dont think posted code is in T-SQL syntax.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2013-12-03 : 09:14:55
It's crystal reports but i believe they are based on sql server.

quote:
Originally posted by visakh16

is this sqlserver? I dont think posted code is in T-SQL syntax.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-03 : 09:26:14
quote:
Originally posted by AdamWest

It's crystal reports but i believe they are based on sql server.

quote:
Originally posted by visakh16

is this sqlserver? I dont think posted code is in T-SQL syntax.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs





The code you posted is not a SQL Server query code
it might be crystal report expression in which case you may be better off posting it in some crystal report forums

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -