date calculation. Please help.
I know I posted this before but maybe I was not clear enough with my question. Therefore, I am posting the question again. I hope this would be clear enough.
my problem is that I would like to do a cross-tab report that calculate values from a
i all,
I am working on a report that shows monthly sales activities.
At this point, i have created a crosstab that shows sales information by month (see example below) but I want somehow to show percent increase/decrease from month to month. Can anyone point me to a tutorial or any source code to perform this action? I have been searching online for over a week and no luck yet.
thanks in advance.
Sales by month:
............................01/2006............02/2006........... 3/2006
Internet sales..........50,000.............10,000..............8,000
In-store sales............6,000.............20,000............15,000
Catalogs sales...........9,000..............1,800...............3,400
PS. I am using visual studio .net 2005
Re: date calculation. Please help.
Might not be what you are looking for but another way to handle this is to use PIVOT TABLES on your SQL statement. This way, you would have set everything up already and can easily compute for the percentages you want.
**********
Data Example:
**********
Yr (int), Qtr (int), Sales (money)
1999,1,44
1999,2,50
1999,3,52
1999,4,49
2001,1,46
2001,2,53
2001,3,54
2001,4,47
**********
SQL Statement
**********
SELECT Yr AS 'Year',
Sum(Case Qtr WHEN 1 THEN Sales ELSE Null END) AS Q1,
Sum(Case Qtr WHEN 2 THEN Sales ELSE Null END) AS Q2,
Sum(Case Qtr WHEN 3 THEN Sales ELSE Null END) AS Q3,
Sum(Case Qtr WHEN 4 THEN Sales ELSE Null END) AS Q4,
Sum(Sales) AS Total
FROM MyTable
GROUP BY Yr
******
RESULT
******
Year Q1 Q2 Q3 Q4 Total
--------------------------------------
1999 44 50 52 49 195
2001 46 53 54 47 200
Re: date calculation. Please help.[resolved]
UMM I think I got it. I was taking the wrong approach. I could acomplish the same by working with the grouping and the detail section of the report.