Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SSRS Grouping Problem

Posted on 2015-02-16
4
Medium Priority
?
38 Views
Last Modified: 2015-05-12
Hi,
      I am developing a SSRS Report, which is based on three tables,  Orders , invoice and receipts

the relation between orders and receipts is one to many
the relation between orders and invoice is one to many

and there is no relation between invoice and receipts

I am using left join between these tables to get data.

In my report there are columns related to all 3 tables,


My requirement is date wise filtration of all records , i.e.  if order date is not in between search dates it should not display but if receipts or invoice exists it should be shown.

please find the attachment for sample data and report format. Sample.xlsx
0
Comment
Question by:codeoxygen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40614787
What is the problem that you are having with grouping?
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 40614894
The attached spreadsheet doesn't make any sense, and the question isn't real clear either, so I'll answer this way..

Most SSRS reports will have as a data source a Stored Procedure, which can accept parameters.

So ... Create a Stored procedure that populates your report, with two parameters for begin date and end date.
Test it to make sure that the return set is 'filtered' based on those dates.

Then in SSRS open the data source, set it to the Stored Procedure, and make sure the parameters are set correctly.
When finished, when a user runs the report, they will be prompted for those two parameters.  When values are entered and the 'Run Report' button is clicked, those values will be fed into the Stored Procedure as parameters, return a set that's filtered by them.
0
 

Author Comment

by:codeoxygen
ID: 40615826
my problem is , when order table is joined with receipts table....

Example : Order is raised on 9th feb , for that respective order receipt is raised on 10th feb and invoice is raised on 11th feb.

In my query i am joining as

Select * from  Order O
left join receipts R on R.orderid=O.orderid
Left join Invoice I on I.orderid=O.orderid


here , if i search with from and to  Date= 9th feb date
only order information need to come

if serch with from date = 9th feb and To Date=10th feb

then  order and its receipt should display, that to in different rows.

if search with from date = 9th feb and To Date=11th feb

then  order ,Invoice and its receipt should display, that to in different rows.


this is the condition but if want get receipts details order details will come automatically in query as it is joined based on order, How to hide those order details if they are not in between search date
0
 
LVL 14

Accepted Solution

by:
nishant joshi earned 2000 total points
ID: 40653301
Hello Author,

You can use below code for reference.You need to create one date list which is based on provided data in parameter.

Using that as reference value you can join your order table and it's date to get desire output.

DECLARE 
	@FromDate DATE = GETDATE() - 5,
	@ToDate DATE = GETDATE()

;WITH Dates
AS
(
SELECT @FromDate AS DateList
UNION ALL
SELECT DATEADD(DD,1,Datelist) AS Datelist
FROM Dates
WHERE DateList < @ToDate
)
SELECT *
FROM Dates
INNER JOIN Order O ON o.OrderDate BETWEEN Dates.DateList AND Dates.DateList + 1
left join receipts R on R.orderid=O.orderid
Left join Invoice I on I.orderid=O.orderid

Open in new window

0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question