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.
Related
I have a pair of stored procedures in SQL Server, "Rollup" and "DrillDown". I want to display them using SSRS.
"Rollup" will break down the records in four groups (kind, gender, color, emotional_state) and display total records in these categories. These category-totals will be hyperlinks. In the sketch below, each n is a link.
"DrillDown", when a link is clicked, will open a new report that lists the records.
Rollup:
| emotional_state |
kind gender color | happy | sad | angry |
-----|--------|-------|-------|------|-------|
cat | female | brown | n | n | n |
cat | female | white | n | n | n |
cat | female | black | n | n | n |
cat | male | brown | n | n | n |
cat | male | white | n | n | n |
dog | female | brown | n | n | n |
dog | female | white | n | n | n |
dog | female | black | n | n | n |
dog | male | brown | n | n | n |
dog | male | white | n | n | n |
dog | male | black | n | n | n |
The problem is most n links don't bring up the correct details. A few do. The responses are consistent. It appears for some links the parameters aren't being passed to the DrillDown procedure.
There's no problem running DrillDown with parameters from SQL Server. For example, from this EXEC call and others like it I get expected results:
EXEC my_shema.DrillDown
#kind = 'cat',
#gender = 'female',
#color = 'brown',
#emotional_state = 'happy'
I am able to replicate the intended report as an Excel pivot table. To do this, I ran my_shema.DrillDown with all NULL parameters (obviously the procedure is configured to accept this). I exported to Excel, inserted a pivot table and got a rendering just like above. The totals agree with "Rollup" and the click-through takes me to the correct details.
To me that means the problem has to be in one of these places:
the SSRS design for "Rollup" in Report Builder 3.0.
the SSRS design for "Drilldown" in Report Builder 3.0.
settings for one of these reports in the "Manage > Parameters" menu (found in the same browser view that lets you view the report).
Between those three places, there are dozens of points where I can inspect parameters and twiddle with their settings. But nothing helps. How do I troubleshoot this?
The solution was to rebuild at least one of the reports. I rebuilt Rollup and everything works well.
As I said, there are many places to visit to fully understand parameters. I believe my problem was most likely caused by visiting many of them and worsening the situation by experimenting with fixes. Starting fresh on the Rollup report looked promising when I realized I'd built in the four parameters when actually it doesn't even use them. (I had been wondering if a parameter is a kind of object variable which needs a defined scope for visibility to the other object/report. No...it's not that complicated.)
Plus, I discovered that rebuilding the report only took 15 minutes. It felt embarrassing after I had spent a few hours kicking at the first version, but I'm new to SSRS so it's just another thing to learn.
#StevenWhite's comment was very helpful, indirectly. Besides offering a useful initial approach, it got me thinking more clearly in general.
I have a weekly sales report across several locations. I need to include the week's total and the running total for each.
Location | Week1 | Week2 | Week 3 | Total
____________________________________________________________
Boston | $45000 | $48000 | $54000 | $147000
------------------------------------------------------------
Boston RTotal | $45000 | $93000 | $147000 |
------------------------------------------------------------
New York | $78000 | $84000 | $92000 |
------------------------------------------------------------
New York RTotal | $78000 | $162000 | $254000 | $254000
I think you can achieve that by using RUNNINGVALUE function and playing around with matrix grouping settings.
First create a matrix with these groups:
Now in the highlighted cell use the following expression:
=RunningValue(Sum(Fields!Sales.Value),Sum,"Location")
Note Location is a group in my matrix.
RunningValue will evaluate the Sum(Fields!Sales.Value) expression and sum the values in the given scope. When you preview the report it will produce the following matrix:
Hopefully this is what you require, let me know if it helps.
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!
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
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).