Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Development Tools
 Reporting Services Development
 Advice on creating a comparison report
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 08/21/2012 :  18:08:21  Show Profile  Reply with Quote
I'm looking for advice on how to create a certain type of

My data looks like this:

Select Date, Product, NumberSales, Price, TotalSales
From SalesData;

I want to create a report that compares sales over several
days like this:

Product Sales | Number of Sales                       | Price                                 | Total Sales               |
Product Name  | Today | -1 day change | -2 day change | Today | -1 day change | -2 day change | Today | -1 day  | -2 days |
Product 1     | 5     |      +1       |      -3       | $30   |       - $32   |  +$23         | $150  |   -$100 |  + $40  |
Product 2...
Product 3...
Product n

In the "Today" column I'm using actual value from my query,
but in the -1 and -2 day change columns I'm using a value
of the difference between Today and previous days data.

Is there a name for this type of report that I can use to
research ways to do it?

Or even better, are there any examples on how to do this type of report?

Right now I am thinking I'll create 1 or more queries for my main data.

Then somehow query that query data to create the calculated columns.

The calculated columns would be specified in the report and the rows would
repeat for each product. I'm not sure if this is the best way to go about
doing this type of report?

Edited by - webdtc on 08/21/2012 18:11:02

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 08/21/2012 :  19:18:22  Show Profile  Reply with Quote
you need to ude matrix container for generating this type of report. you need to bring data grouped by days elaped from current date (datediff(dd,datefield,getdate())) and then on custom group based on fields numberofsales,price etc

easiest way is to create a temporary table with required columns and populate it with required data. then use select * from temptable as query for the report and drag and drop a matrix and link dataset to it

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000