RDLC Design Group Horizontally - reporting-services

Forgive me for the title as I don't know how to put this in words.
Expected Output:
# | X | Y | # | X | Y
1 |A1 |A2 | 26 |B1 |B2
2 27
3 28
. .
. .
. .
25 |D1 |D2 | 50 |E1 |E2
I want to limit the row count to 25 and I want to continue horizontally.
The main reason why the format of the report I want to make is like this is to consume the entire page. The columns # X Y would only have a width of 4 inches in total, thus we expect that rows 51-100 will be on the 2nd page of the report.
Is this possible? I am familiar with paging in RDLC through the use of groups but the rows would repeat vertically downwards which is not what I'm looking for.
I can group my data from 1 to 25 as Group 1 and 26 to 50 as Group 2 and so on, but I don't know how to display the group horizontally.
I am open to new designs as long as the page will filled with data.
P.S. We're not a fan of putting papers to waste.

In essence, you are looking to create a grouping in your SQL dataset every 25 rows, which you can then create a column grouping on in your report.
SQL Example that groups every 25 records (no access to SQL Server at the moment so the code isn't tested but you can see the idea):
WITH T AS (
SELECT ROW_NUMBER() as RowNum,
tbl.#, tbl.X, tbl.Y
FROM tbl
)
SELECT
(T.RowNum) / 25 as GroupID,
T.X,
T.Y
FROM T
GROUP BY ((T.RowNum) / 25)
Once your dataset has this new "GroupID", create a column grouping on this field and that should create the additional columns to fill the page up.

It has been decided that we would give up on this design. I am now using a simple table without grouping to display the data. Columns were expanded from a total of 4in to 8in so that there will be less unused space in the paper.

Related

SSRS - Reducing Processing time

My reports are paramaterized stored procedures, with no filtering at the report. No graphs or eye candy, just data, with 1 or 2 levels of grouping, with the data ordered in SP.
The user can chose which columns they wish to see - typically they choose the supplied defaults, but can choose from up to 100 additional optional columns.
The Tablix has logic to "hide" columns the user doesn't want to see.
The stored procedure part is fast, but the Processing Time at SSRS takes typically about 95% of the Total Time.
Any ideas on how to make SSRS process a set of columns (that could be different for each user) more quickly? Even hidden columns seem to be fully processed - is there any way to make SSRS more efficient at ignoring what it won't need?
Thanks for your thoughts.
SSRS 2016, Oracle 12G
I would use a matrix and have the optional columns returned as rows from the SP so instead of something like
ColumnA | ColumnB | Optional1 | Optional2 | Optional3 | Optional4
ABC DEF 5 10 15
GHI KJL 20 25
It would return something like
ColumnA | ColumnB | OptionalCol | Amount
ABC DEF 'Optional1' 5
ABC DEF 'Optional2' 10
ABC DEF 'Optional4' 15
GHI KJL 'Optional1' 20
GHI KJL 'Optional4' 25
In report you could use a matix with a column group grouped on OptionalCol
This might make the SP slightly slower but would mean SSRS only has to render enough columns for the data selected. It also makes the design a lot simpler as you don't have to worry about hiding columns.

Add variance in the rows of table

I've a SSRS report which should look like below,
--------------------------------
Year Product Total customers
--------------------------------
2015 prd1 100
prd2 50
prd3 60
2014 prd1 80
prd2 60
prd3 60
Varience
Prd1 20
Prd2 -10
Prd3 0
I've done the year wise grouping and the data mapping. But I'm not sure how to add variance(between 2015-2014) in each row based on the each product of the year
Update:
My dataset looks like this
Year CategoryId CategoryDesc TotalCustomerCount
2013 Prd1 Testproduct 100
2013 Prd2 Testprod2 50
2013 Prd3 Tesrprod3 45
2014 Prd1 Testproduct 80
2014 Prd2 Testprod2 60
You can see that some products may miss out in a year.
Note: The dataset is created from a Dimesional cube and not from SQL queries.
It is kind of hard to tell exactly without knowing what your current dataset looks like.
But I believe that Stanislovas' example will be of little use to you because his example only works if your dataset has a single row for each product, with columns with the total for each year. Which I'm guessing you do not have because you used row grouping to get the above result. If you did, you could've used column-grouping instead of row-grouping to get a better overview.
You have two possibilities:
Replace your current dataset completely with a dataset that has columns for each year value (like in Stanislovas' example). To achieve this kind of dataset you need your query to look like this for example:
SELECT DISTINCT(myTable.Product), t1.Total AS 'Total2014', t2.Total AS 'Total2015'
FROM myTable
JOIN (SELECT Product, SUM(Total) AS Total
FROM myTable
WHERE Year = 2014
GROUP BY Product) as t1 ON t1.Product = myTable.Product
JOIN (SELECT Product, SUM(Total) AS Total
FROM myTable
WHERE Year = 2015
GROUP BY Product) as t2 ON t2.Product = myTabel.Product
This can then be used to make a table that looks like this:
---------------------------------------
| Product | 2014 | 2015 | Variance |
---------------------------------------
| prd1 | 100 | 80 | 20 |
| prd2 | 50 | 60 | -10 |
| prd3 | 60 | 60 | 0 |
...
Or you can add a second datasource that has calculated these differences before sending it to the reporter. Here is an example to help you with your query: https://stackoverflow.com/a/15002915/4579864
If you need any more help, just leave a comment and I'll try and explain furthur. This should at least get you started.
I think the easiest way to handle this requeriment is generating the data from the query using T-SQL. However the output you require can be produced from SSRS using a dataset with the same structure as the dataset you provided in the update.
In order to recreate your scenario I used this dataset.
Year Product CategoryDesc TotalCustomerCount
2013 Prd1 Testproduct 100
2013 Prd2 Testprod2 50
2013 Prd3 Tesrprod3 45
2014 Prd1 Testproduct 80
2014 Prd2 Testprod2 60
My approach is take the minimum and maximum year values (2013 and 2014) and the product in every row and look up the TotalCustomerCount to substract it. This is a step by step guide.
First, create a calculated field in your dataset. Right click the dataset in Report Data pane, call it Year_Product and set this expression in the field source textbox.
=Fields!Year.Value & "-" & Fields!Product.Value
This will produce an additional field called Year_Product which has Year and Product fields concatenated with the - character in middle. In example: 2013-Prd1, 2014-Prd1, 2013-Prd3 etc.
Now create a tablix with this data arrangement:
In the cell highlighted in red use this expression:
=Lookup(Max(Fields!Year.Value,"DataSet13") & "-" &
Fields!Product.Value,Fields!Year_Product.Value,Fields!TotalCustomerCount.Value,"DataSet13")
-
Lookup(Min(Fields!Year.Value,"DataSet13") & "-" &
Fields!Product.Value,Fields!Year_Product.Value,Fields!TotalCustomerCount.Value,"DataSet13")
This will look up the max year and product of the row in the Year_Product field and get the TotalCustomerCount.
Year_Product: 2014-Prd1 and TotalCustomerCount: 80
Year_Product: 2013-Prd1 and TotalCustomerCount 100
The above example produces -20 since 80 - 100 = -20
It will show us repeated products because every product may be present two times. To avoid this it is necessary to sort the tablix by Product, go to tablix properties and set the below sorting option.
Now hide duplicated rows. Go to tablix properties / Row visibility and select Show or hide based on an expression.
Use this expression ton conditionally hide the duplicated products:
=IIF(
Fields!Product.Value=PREVIOUS(Fields!Product.Value),
true,
false
)
Finally if you preview the report you will see something like this (I recreated your both tables.)
Note I am using only one dataset, the same that you provide in your
question.
Hopefully this what you are looking for let me know if you need further help.

SSRS grouping on multiple tablix

I have main report that has around 10 tablix and one sub report that has 2 charts. I want the each tablix grouped by same column, but every table uses different datasets. By using List control, we can group the tablix and set a page break between each group. For that, list dataset and tablix dataset must use the same dataset name.But I am not sure how to do that for multiple datasets. Could anyone please help me how to group multiple tablix based on same field value.Is it possible using list to do that? TIA
Attached for reference
. Each tablix uses different data sets.but the field names are same.If Service_line column has 10 rows, then I want to display in 10 pages(one page per service line).If I select page break at each tablix, first tablix splits by that field name,after that next tablix starts to split by that field name. I want to show A/R,cash,Adjustments in one page per service_line field and then next page the same tables but different service_line. So I thought Put in List all tables together and grouping at List level will solve the problem.Could you please help me on that? or if you have any other suggestions please let me know. I am not sure how to get this done. Appreciate your help.
If I understood you correctly, what you want to do is modify your data a little and use nested grouping.
Combine your datasets into one dataset using unions and label each row with column 'Category'that has value ('A/R', 'Cash', 'Adjustments')
for example your dataset might look something like this
CATEGORY | SERVICE_LINE | Total | ...
-------------------------------------
A/R | A | 100
A/R | B | 10
A/R | C | 1000
Cash | B | 50
Adjustments | B | 100
Cash | A | 5
Cash | C | 400
Adjustments | C | -100
Adjustments | A | 9999
after that you will create a 1 tablix (forget about the lists). And inside that tablix you will create a row group for Category and merge all columns and set value for the cell as [CATEGORY]. Also for this row group you want to set Page Break options as "Between each instance of a group". After that create a row below that contains all the column labels Service_line, Total, etc.
Now what you have to do is create one more row group as Adjacent Below and use Service_Line as group by attribute.
with some UI tweaking you can get it to look as you want.

MySQL - Select row with column + X > column

We have a database for patients that shows the details of their various visits to our office, such as their weight during that visit. I want to generate a report that returns the visit (a row from the table) based on the difference between the date of that visit and the patient's first visit being the largest value possible but not exceeding X number of days.
That's confusing, so let me try an example. Let's say I have the following table called patient_visits:
visit_id | created | patient_id | weight
---------+---------------------+------------+-------
1 | 2006-08-08 09:00:05 | 10 | 180
2 | 2006-08-15 09:01:03 | 10 | 178
3 | 2006-08-22 09:05:43 | 10 | 177
4 | 2006-08-29 08:54:38 | 10 | 176
5 | 2006-09-05 08:57:41 | 10 | 174
6 | 2006-09-12 09:02:15 | 10 | 173
In my query, if I were wanting to run this report for "30 days", I would want to return the row where visit_id = 5, because it's 28 days into the future, and the next row is 35 days into the future, which is too much.
I've tried a variety of things, such as joining the table to itself, or creating a subquery in the WHERE clause to try to return the max value of created WHERE it is equal to or less than created + 30 days, but I seem to be at a loss at this point. As a last resort, I can just pull all of the data into a PHP array and build some logic there, but I'd really rather not.
The bigger picture is this: The database has about 5,000 patients, each with any number of office visits. I want to build the report to tell me what the average wait loss has been for all patients combined when going from their first visit to X days out (that is, X days from each individual patient's first visit, not an arbitrary X-day period). I'm hoping that if I can get the above resolved, I'll be able to work the rest out.
You can get the date of the first and next visit using query like this (Note that this doesn't has correct syntax for date comparing and it is just an schema of the query):
select
first_visits.patient_id,
first_visits.date first_date,
max(next_visit.created) next_date
from (
select patient_id, min(created) as "date"
from patient_visits
group by patient_id
) as first_visits
inner join patient_visits next_visit
on (next_visit.patient_id = first_visits.patient_id
and next_visit.created between first_visits.created and first_visits.created + 30 days)
group by first_visits.patient_id, first_visits.date
So basically you need to find start date using grouping by patient_id and then join patient_visits and find max date that is within the 30 days window.
Then you can join the result to patient_visits to get start and end weights and calculate the loss.

To calculate sum of the fields in a matrix with column grouping

I am working on a ssrs report with column grouping. the followin is my scenario.
Matrix 1:
ID 2012 2013
1 20 40
1 30 50
Total 50 90
Matrix 2:
ID 2012 2013
1 60 70
1 60 80
Total 120 150
I need the sum of matrix1 and matrix2 like below:
ID 2012 2013
1 170 240
But I got the result like :
ID 2012 2013
1 410 410
I have applied column grouping in all the 3 matrices and gave the expression to get sum for matrix 3 as: =Sum(Fields!amount1.Value, "dsmatrix1") + Sum(Fields!Tamount1.Value, "dsmatrix2")
Please help me to get a solution for this.
Thanks!
I think I know what's going on. Correct me if I'm wrong.
Based on what I'm seeing, I'm guessing that Matrix 1 and Matrix 2 only have three fields each, an ID field, an amount field (being "amount1" or "Tamount1"), and a year field.
Your column grouping is manipulating the display of the data to show all values broken out by year. This works fine when looking at data from a single dataset. However, your formula is specifying that the sum of everything in the Amount1 field of dsmatrix1 and the Tamount1 field of dsmatrix2 should be added. This does not take into account the column grouping. Your expression is essentially taking all of the values from both datasets and adding them together.
Not knowing more about your query structure or how the data is filtered, my best guess is that you need another SQL dataset. In this case, you would take the queries from your two previous datasets and union them with the "Union All" command. Note that you will want to use Union All and not just Union. More on that here: What is the difference between UNION and UNION ALL?
Your end result should look something like this:
--This will be your dsmatrix1 query copied and pasted
Select ...
Union All
--This will be your dsmatrix2 query copied and pasted
Select ...
--Place one single Order by clause at the bottom
Order by ...
Note: for your two queries to be unioned properly, you'll need to make sure that each have the same number of fields, each with the same data types. Then you can point your third matrix to the new dataset.
Hope that helps!