Hide all middle columns in SSRS - reporting-services

I have a matrix report in SSRS 2008 displaying information about a Company and the total points earned by each company for a selected Quarter.
Example
Company | Current | Previous | Diff |
--------------------------------------
| Q3 2008 | Q2 2008 | |
--------------------------------------
Comp 1 | 2000 | 1500 | 500 |
--------------------------------------
Comp 2 | 1200 | 1400 | -200 |
--------------------------------------
In my SSRS report I have a RowGroup based on my Company field from the data set ([Company]).
And I have a ColumnGroup based on my Quarter field from the data set. Sorting in the group is reversed because I want to start with the latest quarter.
I have parameter for selecting companies and 2 parameters for selecting quarters (QuarterCurrent and QuarterPrevious).
As a side effect if I select 2 quarters that are not consequent I get more than 2 columns which is something that I do not like.
But then I thought that if I could hide the columns in the middle and display on the First (QuarterPrevious) and the Last (QuarterCurrent) I will be able to compare any quarter to any other quarter.
My question is about hiding the columns in the "middle" of the matrix. I am trying to
achieve something like this:
Company | Current | *(HIDDEN)* | Previous | Diff |
----------------------------------------------------
| Q3 2008 | *Q2 2008* | Q1 2008 | |
----------------------------------------------------
Comp 1 | 2000 | *1500* | 1300 | 700 |
----------------------------------------------------
Comp 2 | 1200 | *1400* | 1250 | -50 |
----------------------------------------------------
So in the end I will have only the Current and the Previous columns visible.
I tried the following approaches:
Setting the Column Visibility property to:
=IIF(StrComp(Fields!Quarter.Value,First(Fields!Quarter.Value))=0 OR StrComp(Fields!Quarter.Value,Last(Fields!Quarter.Value))=0,False,True)
In my understanding this should set the property Hide to False to each column that is equal to the First and the Last values in the sequence, and to True to all the others. However it does not happen like this, but all columns were hidden.
I tried setting the same expression to the Visibility property in Group Properties. Still has the same effect - all columns were hiding.
Edit : format code

Instead of two parameters for your quarter selection, have you tried a multi-select dropdown parameter ?

I solved the issue in the following way:
Instead of using parameter with range (From and To) I used a parameter with two values and my queries is not BETWEEN From and To, but rather IN [From, To]. The values of From and To can be any 2 quarters (they can even be switched - From does not have to be before To).

Related

SSRS: Using tablix with multiple Dataset

I have two datasets:
My First dataset (Students) looks like this:
Student_Name| ID
Jack Luis | 1
Adam Bob | 2
And my second dataset (Exam) looks like this:
Student_ID | Exam | Note
1 | Java | 15
1 | Php | 14
2 | Java | 12
2 | Php | 13
I want to get this in the same Tablix:
Student Name | ID
Jack Luis | 1
Adam Bob | 2
Student_ID | Student Name | Exam | Note
1 |Jack Luis | Java | 15
1 |Jack Luis | Php | 14
2 |Adam Bob | Java | 12
2 |Adam Bob | Php | 13
Thank You Mr alejandro zuleta
but i want the result like this in the same Tablix (using groupin By Name)
Studant Name:Jack Luis
Exam | Note
Java | 15
Php | 14
Studant Name:Adam Bob
Exam | Note
Java | 12
Php | 13
I think this can be solved using LOOKUP function. LOOKUP function joins multiple dataset using a common field in the involved datasets.
Create a tablix and set the DataSetName property to your second dataset.
Drag and drop the fields to the columns you want to show. For the Student Name column use the following expression:
=Lookup(Fields!Student_id.Value,Fields!Student_id.Value,Fields!StudentName.Value,"DataSet21")
In the above expression replace DataSet21 by the actual name of your
first dataset.
It will preview something like this:
UPDATE: Grouping by a header row.
Add a tablix and set your second dataset in DataSetName property. Add Exam and Note fields to the corresponding columns.
Add a Parent Row Group.
In the Tablix group window select the Add group header checkbox and use the following expression:
=Lookup(Fields!Student_id.Value,
Fields!Student_id.Value,Fields!StudentName.Value,"DataSet21")
Delete the first column created by the previous grouping setting.
In the cell above Exam use the following expression:
="Student Name: " &
Lookup(Fields!Student_id.Value,Fields!Student_id.Value,Fields!StudentName.Value,"FirstDataSet")
Now select Exam and Note row and add a row above outside the group.
Type Exam and Note in the corresponding cell above [Exam] and [Note] fields.
Select the three cells in the first row, right click it and select Merge Cells.
It will preview something like this:
If you want to delete the first blank row, you can do it smoothly.
Let me know if this helps.

SSRS Single row for Grouping

I'm working with SharePoint Lists, I have 2 Lists for this issue i.e. Movies & Theatres. Only one list is used tough, because Theatres reference a movie.
(I know this is weird but I'm not actually working with movies and theatres, it's just using an analogy so anyone could understand the problem so let's assume each Theatre only plays a single movie :-P )
So from the Theatres list I create a dataset with following fields: Linked_Movie (Title), Country, Theatre_Number.
I want to create a report that shows a tablix that lists all Movie-titles with all the countries it's shown in and a count of the theatres that are playing that movie. So the tablix should look like example below:
MovieTitle | Country | # of theatres
| |
Movie 1 | Country A | 5
| Country B | 10
SubTotal | 2 | 15
| |
Movie 2 | Country C | 15
SubTotal | 1 | 15
| |
Total | 3 | 30
I have already created a tablix which groups on Linked_Movie first and Country second. Then in the details-section I just count the theatres that play that certain movie in that specific country. To achieve this I created a second dataset with the exact same data so I could use LookUpSet.Length. But even though my calculations are correct the tablix still generates a row for each individual theatre. So my tablix actually looks like example below:
MovieTitle | Country | # of theatres
| |
Movie 1 | Country A | 5
| | 5
| | 5
| | 5
| | 5
.... | ... | ...
So if anyone knows how I would be able to achieve a tablix like the first example that would be greatly appreciated.
If anything is still unclear please don't hesitate to ask.
Kind regards
Gravinco
I was able to solve it by adding a calculated field to the dataset named MovieCountry.
After this I put the expression below as the condition for 'Row visibility' and the visiblity of the '=(Details)' properties:
=iif(Fields!MovieCountry.Value = Previous(Fields!MovieCountry.Value), True, False)
This way I only get a single row for each movie and country combination.
Any questions are always welcome!

How to pull required data from table the way Crystal is pulling it?

I have a view set up like the below table, which is pulling data from multiple other tables using JOINS. Basically I'm trying to replicate a Crystal Report that breaks up the data below into Job # - Weekly (hrs) - TotalToDate(hrs) - Budget(hrs)
And this is broken up per department. The way the report does it is it'll display the hours for the last week, then the total hours to date then the budgeted hours set for that department.
Table doesn't reflect above - just an example of what DB table looks like.
+-----------+------------+---------------+--------+---------------------+
| Job | Work_Date | Work_Center | Est_Total_Hrs | Act_Run_Hrs |
+-----------+------------+---------------+--------+------+--------------+
| 5666 | 2014-02-23 | SURFACE | 155 | 5 |
| 5666 | 2014-02-16 | SURFACE | 155 | 3 |
| 5666 | 2014-02-23 | DESIGN | 200 | 6 |
| 5666 | 2014-02-16 | DESIGN | 200 | 4 |
| 5666 | 2014-02-23 | SURFACE | 150 | 2 |
| 5666 | 2014-02-16 | SURFACE | 150 | 2 |
| 5666 | 2014-02-23 | DESIGN | 300 | 8 |
+-----------+------------+---------------+---------------+--------------+
Also, theres a lot of different job numbers, and when I pull up more than 1 job in Crystal it'll show the report like the picture above but with all jobs I want to retrieve.
How would I go about pulling this data so it shows up the same way in the Crystal Report? I want to create a view that looks the same. Is there a way to see how Crystal does it? When I click "Show Query" it shows me the below query which I had to re-write a little bit for it to work in SQL Server and in Adminer.
Query I'm using to pull ALL data for all Jobs within an updated Work_Date in the last 90 days.
SELECT Job_Operation.Work_Center
,Job_Operation.Job_Operation
,Job_Operation_Time.Work_Date
,Job_Operation.Est_Total_Hrs
,Job_Operation_Time.Act_Run_Hrs
,Job_Operation_Time.Act_Setup_Hrs
,Job.Description
,Job_Operation_Time.Overtime_Hrs
,Job_Operation_Time.Act_Setup_Hrs
,Job.Job
,Job.Description
,Job_Operation_Time.Labor_Burden
,Job_Operation.Est_Setup_Labor
,Job_Operation.Est_Run_Labor
,Job_Operation.Est_Labor_Burden
,Job_Operation.Operation_Service
FROM Job AS Job
LEFT OUTER JOIN Job_Operation AS Job_Operation ON Job.Job = Job_Operation.Job
LEFT OUTER JOIN Job_Operation_Time AS Job_Operation_Time ON Job_Operation.Job_Operation = Job_Operation_Time.Job_Operation
WHERE DATEDIFF(day, Work_Date, GETDATE()) < 90 ORDER BY Work_Date Desc
Crystal will take the data from a query and does its internal manipulation as per the design of the report, So if you need the table exactly as you view the report then along with the query in crystal report you need to make some changes.
Suggestions:
Your report has only 6 columns but you query has more than 10 columns so you need to change the query so that it has only 6 columns.
Report has data according to the week but query has hourly data so you need to write some functions in query so that you manage to get weekly data from hour data
You said when you take more than 1 ID you get in the given format then in that case add some group by conditions to the resultant query so that all data is grouped. for e.g if you need only one ID then group by ID so that there is only one record for a ID.
Try adding some group by conditions some date formulas to get exact output

Chart reporting in SSRS

I am using SQL Server Reporting to display data using a chart. How do I create my dataset so that the graph displays one line for males & one line for females.
Thanks
Beth
Do you mean two lines as in
one per x or y axis
one per data series
This stupid thing won't allow me to comment so I'm wasting space with an answer
I think what you want is to separate the males and females into different data series. You can go this in the chart properties, as long as you have enough information in your data set.
If your data set looks something like this:
+-----------+-----+-------+
| Date | Sex | Count |
+-----------+-----+-------+
| 2009-01-1 | M | 124 |
+-----------+-----+-------+
| 2009-01-1 | F | 78 |
+-----------+-----+-------+
| 2009-01-2 | M | 95 |
+-----------+-----+-------+
| 2009-01-2 | F | 101 |
+-----------+-----+-------+
Then if you have the Date as the X-Axis variable, Count as the Y-Axis, and add the Sex as the Series Grouping, the it should automatically split them into two graph lines, and add a Legend etc.

How do you get the records from single dataset to display onto 4 corners of landscape page? [SSRS]

I am using Microsoft SQL Server Reporting Services 2005
I have a report that when printed I want to display a record in each of the 4 corners of a landscape page.
I am using a single Dataset that returns 1 to many records.
How do I accomplish this with a table or matrix?
For example if I had 6 records in my dataset:
Page 1
|---------------------|
| record 1 | record 2 |
|---------------------|
| record 3 | record 4 |
|---------------------|
Page 2
|---------------------|
| record 5 | record 6 |
|---------------------|
| [empty] | [empty] |
|---------------------|
So I have found a successful way to do this (with help from cdonner's suggestion), have 2 identical table templates and have one display all odd records and the other to display all even records.
This is what Design Mode looks like:
|-------------------|
| table 1 | table 2 |
|-------------------|
Then, what I did was on each tablerow of each table added the expressions to the Visibility > Hidden property of the tablerow:
For Odd Rows:
=RowNumber(Nothing) Mod 2 = 0
For Even Rows:
=RowNumber(Nothing) Mod 2 = 1
The only way I can think of is by using subreports, one showing all even rows, the other one showing all odd rows.
To add Groups to Jon's answer, place tables 1 and 2 within a parent table which performs the grouping:
table-parent
group-row-header // header text..?
group-row-footer // group name is important for below
rectangle
table-child-1 | table-child-2 | etc // =RowNumber("my-group-name")
Note RowNumber must be based on the group so that it resets with each loop.