all groups > sql server reporting services > may 2006 >
You're in the

sql server reporting services

group:

report builder how to


report builder how to kamel
5/23/2006 1:13:56 PM
sql server reporting services: Is it possible to create following table report:

Col1: All Customers
Col2: Count of Orders in Last 12 months

my customers records get filtered when there is no order is last 12
months
but I'd like to show all customers and count of 0 where there is no
order in last 12 months

any idea?
Kamel
Re: report builder how to kamel
5/23/2006 1:48:10 PM
I talk about Report Builder with Report Model;
notice: Last 12 Months
Re: report builder how to Chris
5/23/2006 4:23:10 PM
If your SQL statement returns the two columns:
SELECT CustomerName, count(OrderID) as CountOfOrders
FROM ORDERTable
GROUP BY CustomerName

Then put those values into a table or list data region.

Is this what you are asking for?
[quoted text, click to view]

Re: report builder how to kamel
5/25/2006 2:01:02 AM
SQL which I would like to obtain in Report Builder:

select
CustomerName,
(select count(OrderID) from Orders where Orders.CustId =
Customers.CustId and OrderDate > '2005-05-01')
from Customers
group by CustomerName

is it possible?
Re: report builder how to larthallor
6/2/2006 10:14:01 AM
Have you checked the cardinality of the relationship of the Customers entity
to the relationship of the Orders entity? It sounds like it should be
OptionalMany, meaning that there may be 0 or more Orders for each Customer.
If it is Many, then you are telling the model that each Customer has 1 or
more Orders.

Setting the cardinality from Many to OptionalMany should change the query
from something analogous to:

select
c.CustomerName,
count(o.OrderID)

from
Customers c
inner join
Orders o
on
c.CustId = o.CustId

where
o.OrderDate > '2005-05-01'

group by
c.CustomerName

to:

select
c.CustomerName,
count(o.OrderID)

from
Customers c
left outer join
Orders o
on
c.CustId = o.CustId

where
o.OrderDate > '2005-05-01'

group by
c.CustomerName

Having said this, my own experiments with Report Builder and Models show
that there may be a bug preventing the outer join from being used, even if
the cardinality is OptionalMany. However, the cardinality will have to be
set properly for it to work.
Re: report builder how to kamel
6/12/2006 5:59:37 AM
Thank you!
It doesn't work with 3 entities as in my exaple (1 entity - "time" is
in a filter)

and relations are as:
Customer - Order - Time

Any ideas,
Kamel

[quoted text, click to view]
Re: report builder how to kamel
7/7/2006 7:59:04 AM
Refrash of topic.

I would like to create following query:
select
Customer.CustomerID,
Time.DayID,
count(Order.OrderID)
from
Customer LEFT OUTER JOIN
Time LEFT OUTER JOIN
Order

with ReportBuilder I can not obtain such a query.
RB puts table from whitch value is on matrix's data area on top, eg.

select
Customer.CustomerID,
Time.DayID,
count(Order.OrderID)
from
Order LEFT OUTER JOIN
Customer LEFT OUTER JOIN
Time

in this example count(Order.OrderID) is on data area of matrix type
report

Any ideas,
Kamel

[quoted text, click to view]
AddThis Social Bookmark Button