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 2005 Forums
 Analysis Server and Reporting Services (2005)
 Two bars/ Customer

Author  Topic 

1sabine8
Posting Yak Master

130 Posts

Posted - 2009-09-08 : 04:24:24
Hi,
I need to build a graph that shows the count of records per customer. For each Customer, i need to show a bar for the number of records for the chosen month (filtered) and another bar for the previous month. For each customer on the x axis, i need to see the 2 bars. Is it feasible? How?
Thanks in advance

svicky9
Posting Yak Master

232 Posts

Posted - 2009-09-08 : 17:09:42
yes..Its possible..

GEt the sql query so that the fields are Customer, Records_CurrentMonth,Records_LastMonth.

you can do the query like

select a.customer,a.records as CurrentMonth,b.records as LastMonth
from
(
select customer,records from table
where datepart(month,datecol) = currentmonth
group by customer
) a
join
(
select customer,records from table
where datepart(month,datecol) = currentmonth - 1
group by customer
) b
on a. Customer = b.Customer

Once you get the results...drag a 2 bar chart and drop the fields..It should be straight forward

http://www.sqlserver007.com
Go to Top of Page
   

- Advertisement -