i have an RDL contains 1 row group and 1 column group
I want to create one more group which wrap both this 2 group
So that group X will be created, and records of row group A & column group A will generate base on group X.
but i found no solution to add that group X.
Is there any solution to do it? or it is impossible in RDL?
Above is the expected result with some important points
A is row group,
C is column group, the string C, C1 ,C2,C3 are actually the data from the same dataset with A, just the grouping parameter is not the same
DATASET
Below are the interesting requirement:
for each group of A (lets say A1&A2), it will display in a new page (ie. new tabs in the SSRS)
there is total row for each row group member
As mentioned C - C3 are generated dynamically based on the dataset. There are total for each group of A and requires to aggregate the sum for both rows,
thus C somehow need to cater the filtered dataset of A, and display the sum
The problem is:
In the page of A1, C1 & C2 will be blanked. C & C3 contains value
In page A2, C & C3 will be blanked and C1&C2 can be displayed
In fact, for the blank column ( for example A1), even the string C1 & C2 also unable to display as A1 didn't contain the data of C1 & C2 at all
I think what you want is not an additional group, but you want to nest your tablix inside of a list object. There's not any way to add both a column group and a row group inside of a universal grouping unless you use another control item. Then, you can add the grouping on the list item and it will do what you need. In the image below, you can see that my tablix is inside of a single row of a list object and the list object is grouped by a master ID for this report. This allows the inner row and column groups to expand as necessary, but separates them based on the master ID. I also put page breaks on this list item to put each ID on a new page.
Related
I did a lookup function in ssrs where the source is a reportItem reference. I want to return the value from the table that I am looking up based on the reportItem reference. The report is retrieving the correct values, but and I'm getting repeated rows and I'd like to know if there's a way to eliminate that. My parameters in the tablix is based on a ticket number.
The underlying data has 3 transactions but 9 rows are currently being returned.
In SSRS, my query is:
Select
ticketno, name, control, value
from ticket a
inner join details b on a.ticketno = b.ticketno
where control like 'LS%' and ticket = 'ED08'
The return result contains 4 rows transactions
ie:
Ticket
Name
Control
Value
ED08
Eng
LS1
A
ED08
Acct
LS2
B
ED08
Med
LS3
C
In SSRS, I used a table and hard coded the Name as it's possible that there will be no values.
I hard coded Eng, Acct, Med, Dent for names.
I entered an expression on each individual row with an expression
=lookup(ReportItems!textbox.Value,Fields!Name.Value,Fields!Value.Value, "UDF_Det")
However, when I run the report, I get extra rows.
The transactions retrieved from the ticket in SQL only retrieved 3 rows, so I would have expected that. Is there a way to filter on row specific data?
I have looked at this post Adding values to a Report when there is no Data in query SSRS but since I am not doing any calculations I'm not sure why I am getting repeat rows.
My design looks like this:
Output looks like this:
Acually, now I've edited your question I understand the problem. :)
You can just get a list of Name and left join from it to your existing query.
You maybe able to get the list from an existing table (hopefully) or you could hardcode one (avoid if possible).
Assuming all the Names you need are in your ticket table you could use something like this...
SELECT DISTINCT [Name] FROM ticket
(if name comes from another table, just change the query to suit)
then left join your existing query to this, something like
SELECT n.[Name], t.ticketno, t.control, t.value
FROM (SELECT DISTINCT [Name] FROM ticket) n
LEFT JOIN (
Select ticketno, name, control, value
from ticket a
inner join details b on a.ticketno = b.ticketno
where control like 'LS%' and ticket = 'ED08'
) t
ON n.[Name] = t.[Name]
which should give you something like
Name
Ticket
Control
Value
Eng
ED08
LS1
A
Acct
ED08
LS2
B
Med
ED08
LS3
C
Dent
NULL
NULL
NULL
Then you can simply have one row in the detail group in your table to output the results.
If this does not help, post some sample data from your database tables and show the full report design including row groups etc
I am trying to write an SSRS report where the output is grouped by team, with each team starting on a new page, and on a new tab when the report is output to Excel. I want the column headers to repeat each time there is a new team, and at the top of each page if one team's data spans more than one page.
My test data is generated by the following code:
WITH
team_list(team_id,team) AS
(
SELECT 1, 'red'
UNION ALL SELECT 2, 'orange'
UNION ALL SELECT 3, 'yellow'
UNION ALL SELECT 4, 'green'
),
results1(result_value1) AS
(
SELECT 1
UNION ALL SELECT 2
UNION ALL SELECT 3
UNION ALL SELECT 4
UNION ALL SELECT 5
),
results2(result_value2) AS
(
SELECT 7*result_value1
FROM results1
),
main_query(id, team, value1, value2) AS
(
SELECT
tl.team_id
, tl.team
, r1.result_value1+20
, r2.result_value2
FROM
team_list tl CROSS JOIN results1 r1 CROSS JOIN results2 r2
WHERE
r1.result_value1 < tl.team_id+2
)
SELECT * FROM main_query
I want the report to look like this:
I inserted a Tablix with three columns: id, value1 and value2. I right-clicked on Details under "Row Groups", and did Add Group>Parent Group, Group by Team. I did not tick either "Add group header" or "Add group footer".
I clicked on Team under "Row Groups". Then in the Properties Window, which was showing "Tablix Member", I expanded Group and then Page Break, and set Page Break to Between. I also set PageName to Fields!team.Value.
To get the column headers to repeat, I clicked on the down arrow next to "Column Groups" and chose Advanced Mode. I clicked on the second occurrence of Static under "Row Groups" and in the Properties pane, set RepeatOnNewPage to True. I now had a report with a page break between teams, and it repeats the column headers on every page. When I exported it I got a tab for every team with the team name on it. Good.
Now, I do not want the first column of the table, Team. So I right-clicked the column and chose Delete Columns, then Delete Columns Only. I saw that under "Row Groups" the top "Static" had disappeared. My report no longer repeated the column headers on every page.
I tried hiding the two cells in the first column of the table, and this seemed to give the desired effect, apart from indenting the table to the right. I tried to set the width of this column to zero, which does not seem to be possible. When I exported the report I got a very narrow Column A. Is there any way of getting rid of this column altogether, while still having repeating column headers?
For my team heading, I inserted a row above the top row of the Tablix. I merged the three cells above my column headings. I right-clicked and added the expression ="Team " & Fields!team.Value. This displayed "Team red" for all the teams, instead of changing on each page. How can I make a heading row that will show the correct team name for each group?
You need an extra row in the team group. The easiest way is to do this is to add a header when you added your team group.
So in the 1st paragraph of your step-by-step..
from Details to Add Group -> Parent Group, select Team and check the add header option.
Double-click the new Team row group in the row group panel and set page breaks to between
Now you will have three rows in the table, ignore the fact that rows 2 and three are merged in column 1, we'll get rid of that once everything else is done.
Right-Click on one of the cells in row 2 (e.g. column 2 row 2) and choose Insert Row -> Inside Group - Above.
the table will look something like this..
Next copy the column hedaers (id, value1 and value2) to hte row direclty above the cells with the actual data in (should be row 3).
Then in row 2 select the three cells above your data column and merge them.
Select team as the field for this merged cell (or your expression)
It should now look something like..
Now delete the first row and first column as we don't need these anymore.
Next click the advanced mode from the drop down next to the column groups as you did before.
Select the two static items in the ROW GROUPS and set the "RepeatOnNewPage" to true.
Finally, for testing, I set the interactive size height property of the report to 10cm (so I could force some page breaks before then end of each group).
After following this, the report worked as expected, below you can see the 2nd page for yellow has the correct header.
In case it's useful, I used Report Builder 2016 to build the sample RDL. You can get hold of it here, you'll just need to edit the connection properties to get it to run.
Link to GroupHeaderRepeat.rdl
https://1drv.ms/u/s!Al1Kq21dFT1ijb5Qmm2P4zyM1MV4pA
I have a form showing Customers. Now I would like to also display all Orders that the currently open customer has made.
The Order table has a foreign key to Customer.
I have tried using a list box with Multi Select set to Simple, but somehow it shows me all Orders instead of just the ones of the current customer.
More Details:
My list box has
Control Source: ID
Row Source: SELECT customer.id, order.info FROM customer
INNER JOIN order ON customer.ID = order.customer_id
If I set the Multi Select to None it always marks the first Order that matches the current customer, but not all matching orders.
Can someone point me in the right direction?
Thank you.
P.S. I don't necessarily want the list to be functional for the creation of a new Customer. If it would also work then that's a bonus.
Assuming your form is bound to Customers table, then you need to add code to the form's Current event:
lstOrders.RowSource = "SELECT id, info FROM order WHERE customer_id = " & Me.id
lstOrders.Requery
The list box (called lstOrders) should have its column count set to 2. If you don't want to see the order.id column then set the "Column widths" property to 0 (this will set the width of the first column to 0 and let the second column, order.info, fill the remaining width of the list). Set the "Bound column" to 1 - this means that the "value" of the list box will be the order.id
I have an SSRS report based on stored procedure dataset. The report shows employees and their performance rating and uses bunch of parameters to filter the data.
Now I would like to add a table below that would dynamicaly count and show occurence of given mark in the main report. The table data should update according to what is visible in the main report after filtering it.
I wanted also to add a chart that would visualize this.
It would be feasible to do if the extra table and chart could run from the same dataset as the main report. This however seems impossible as this dataset does not always contain all the possible marks. It can happen that some marks are missing (when filtered or missing at all), and I would like to show the mark with zero value (and zero value bar in the chart) instead of just skipping it.
So far I was able to produce the table by hardcoding the headers and using SUM(IIF...) expressions under each header
Here is the expression for the "C" column.
=Sum(IIf(Fields!current_performance_rating.Value = "C", 1, 0))
It shows correctly the number of "C" marks appearing in the main report.
Now I am stuck with creating a chart that would show this.
I am not able to hardcode expressions similar to the ones in the table
and can't make the chart run from the main dataset, because the categories
would be missing after filtering the report (and not showing zero).
I tried linking datasets with Lookup function, but that did not work.
Which way should I go now? What is the best practice in such case?
Thank you for any hints!
Thanks trubs.
I have right joined a view that contains
all the marks and that solves the issue
of missing categories.
The join is on something like
tb.current_performance_rating = vw.performance_rating_code
I can now add the value series that counts
the occurence of current_performance_rating
per category. This works all fine.
However there is another table joined
(on employee_id) that stores last year's rating.
This rating obviously may differ to the current one.
On the same chart I would like to add another
series that counts last year's rating per category.
The category is there already, joined to the current
rating.
So you can have row like:
curren rating | last year's rating | category
C | H | C
So I am stuck, because when SSRS groups per category
it counts last year's H rating and displays
i the C category, while it should display it in H.
Sorry I can't post any pictures, seems like I
need more reputation points.
Hope you can understand what I mean.
Regards!
You're likely better off changing your query to return results for marks where there are no values.
So instead of inner joining to your Performance Rating table, use a Right Join or Full Outer Join, so that all the data is always available.
eg: Instead of...
SELECT p.PersonId, PersonName, g.Grade
FROM Person p
INNER JOIN PersonGrades pg ON p.PersonId = pg.PersonId
INNER JOIN Grades g ON pg.GradeId = pg.GradeId
Use
SELECT p.PersonId, PersonName, g.Grade
FROM Grades g
LEFT JOIN PersonGrades pg ON pg.GradeId = g.GradeId
LEFT JOIN Person p ON p.PersonId = pg.PersonId
If that's not clear, post your query and we could help get the data in the right format.
The way to go was to simplify the dataset that the main report was based on.
Then I took the query from that dataset, used COUNT and GROUB BY to count number of occurence of each current year mark in the main report. Then I right joined (thx trubs!) with the view that contains all the possible marks (so that my extra table headers/chart categories would not disappear if they do not exist). As a result I got the number of occurence in current year per mark (table A).
Then I did almost exactly the same for the last year's rating, just used last year's mark. I got the number of occurence of last year's mark per mark (table B).
I inner joined table A and B on common column (the mark, which will always appear thanks to the RIGHT joins). This gave me a table (dataset eventualy) where I had:
mark | current year mark count | last year mark count.
Making a table and chart basing on this was really easy then.
There was some more fun of adding all the parameters from the main report to both the count queries, so that the counts would change when report is filtered. I also needed to make sure that count works not only when my filter criteria (in WHERE stetement) equal the parameter provided from the report, but also when they are NULLs (so I added OR column_i_filter_on IS NULL).
This works smoothly - the table content and chart changes when filtering changes (although runs slowly, as parameters are passed to two big dataset, one of which uses them twice).
Thanks for all the help!!
psh
I have a report which lists the employee list. I want to show the list as below;
A
-----------------
asdas
adfgs
artret
B
-----------------
bifjgdifg
buasüdp
bpopo
C
----------------
cxasdas
coierewf
clasdksa
How can I integrate this grouping type into mine report.
You could do this in the SQL statement that returns the data by adding an additional column that only contains the first letter and is invisible in the report - group by that column then.
Another way could be to change the group-field in the report's group to not group by for example =Fields!Name.Value, but use a string manipulation function to group by only the first letter. For example you could try
= LEFT(Fields!Name.Value, 1)
for the grouping.