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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 calculate weekly sale

Author  Topic 

dPriya
Starting Member

4 Posts

Posted - 2011-07-21 : 02:29:56
hi..
I am doing reporting in SSRS using SQL server 2008.I want to show weekly,monthly and quarterly sale for date whichever date is entered in date parameter.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-21 : 04:28:21
we need more info like how is structure of your sales table,what are aggregations you want to show, what according to you represents sale year etc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

dPriya
Starting Member

4 Posts

Posted - 2011-07-22 : 00:39:31
hiii sir,
I am having one table cust_ledger_entry.This table contains the field Posting Date and Amount.In my SSRS report there in two parameter Posting Date and PeriodLength.PeriodLength is multivalue parameter contains parameter like 1month,2month,3month,4month and 7days.

For example,suppose user entered 31-12-2000 in posting date and 2month in periodlength,then chart should show each slot of two months.means one slot is from 1-11-2000to31-12-2000,second slot is from 1-09-2000to31-10-2000 and so on...and sum of Amount of that perticular two months as data lable.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-22 : 11:41:27
logic same as here

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=163315

SELECT MIN(postingdate) AS StartDate,MAX(postinfdate) AS EndDate,SUM(salesamount) AS TotalSales
FROM cust_ledger_entry
WHERE postingdate BETWEEN DATEADD(yy,DATEDIFF(yy,0,@Date),0) AND @Date
GROUP BY (DATEDIFF(mm,postingdate,@Date)-1)/@Periodlength


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -