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.
Author |
Topic |
webdtc
Starting Member
1 Post |
Posted - 2012-08-21 : 18:08:21
|
I'm looking for advice on how to create a certain type of report.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? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-08-21 : 19:18:22
|
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 etceasiest 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 MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|