I've sub-report in one of the SSRS Tablix Cell. It works fine when details grouping is enabled of the tablix. Like below.
Product | Line Item | Adjusted Billings (sub-report column)
XYZ | $30 | $45
XYZ | $30 | $40
As soon as I group the tablix based on Product then the report comes like below:
Product | Line Item | Adjusted Billings (sub-report column)
XYZ | $60 | $45
But my targeted report output would be like this:
Product | Line Item | Adjusted Billings (sub-report column)
XYZ | $60 | $85
In sub-report, I am also using a tablix with one column and header row is set to invisible. Additionally, I've add Sum() in sub-report column as well but still not able to get required results.
Can someone please let me know what I am missing to get required results?
When you add a parent group to your tablix (in your case the XYZ) then click the option Add group header (or footer). An extra row will appear above the detail row. In the detail row you will see all the detailed data (like you first example table). Above this detail row (the header you added) you can write the following expressions:
'First Cell
=Sum(Fields!LineItem.Value)
'Second Cell
=Sum(Fields!AdjustedBillings.Value)
Now it will be displayed like you want it. You can additionally hide the detail rows, this way you just the the summed data.
Basically what is happening is Your sub report cannot group based on Product, It takes the First row and displays it. This is a very classic SSRS issue/use case with Developers.
What I would suggest, Add Product as a Column in your sub report as well and then try grouping on Main Report, If this does not work try grouping in your sub report based on Product as well. This shall work.
Related
I am having a problem using Lookups in a ssrs report. The report takes in 3 datasets that I do not have the opportunity to edit or merge (three different cubes)
It is a sales report that should be grouped by Sales Manager and show the potential for sales and a "discounted potential" of sales. The problem I face is that I have to loop my table on DataSet1 since it is the only on that holds Sales Mangers.
Using LookupSet and LookupSum it is easy enough to get the potential from DataSet2. Something like:
=Code.LookupSum(LookupSet(Fields!Country.Value, Fields!Country.Value, Fields!Potential.Value, "DataSet2"))
The problem arises when I try to calculate the Discounted Potential form DataSet3
Namely because I need to perform the lookup based on a value that is not in DataSet1! Is this somehow possible?
The datasets and the desired report look like this
You should be able to change the dataset of the tablix to DataSet2 to get the desired results. Dataset2 is the only dataset that directly relates to both of the other datasets, and since nested Lookups are not allowed, and also since you cannot modify your datasets, this is necessary for this situation.
I'm not sure exactly what calculation you are using to end up with your "Discount" column, I couldn't figure out any formula that worked with all of your sample data shown. For my test I just took the Sum to make sure it was working, but you should be able to modify that to fit your needs.
I set up a tablix like so:
+---------------------------------------------------+
| Manager | Country | Potential | Discount |
| <Expr1> | [Country] | [Sum(Potential)] | <Expr2> |
+---------------------------------------------------+
With 2 row groups, the first grouping on Expr1, and the child group grouping on Country, where Expr1 is =Lookup(Fields!Country.Value, Fields!Country.Value, Fields!Manager.Value, "DataSet1") and Expr2 is =Sum(Code.SumLookup(LookupSet(Fields!Customer.Value, Fields!Customer.Value, Fields!Discount.Value, "DataSet3"))). I sorted the parent row group by Country to keep the sorting the same as you had it in your screenshot. Again though, you would likely have to modify Expr2 to fit your needs. If the discount is a percentage for that particular customer, then the following code should work for that, but the results don't match your screenshot so I'm not sure if this is what you are looking for:
=Sum(Fields!Potential.Value - (Fields!Potential.Value * Code.SumLookup(LookupSet(Fields!Customer.Value, Fields!Customer.Value, Fields!Discount.Value, "DataSet3")) / 100))
Results from using the modified Expr2 if Discount is a percentage:
I need to create a report which is something similar to a Pivot Table.
The report would be something like below, with more towns
I C S Total
Town1 1 2 3 6
Town2 7 1 1 9
Town3 2 3 1 6
Total 10 6 5 21
In Crystal reports, there is an integrated function called Cross table
(see pictures below)
I'm looking for a similar function in SSRS, if there is any. I parsed the internet but I could not find anything that is relevant
Thanks!
You need a matrix to do so
Select the row, once the matrix created, like the image below and click on the row group and look at the group properties
You then choose the row for which you want to do the grouping like the image below
Repeat the operations for the column group.
You will need to add additional row and columns for the total.
I will do that for the row. You click the row to highlight it and then click on insert rows. You then choose Outside group below like in the picture below
Repeat the operations for the column group.
To have total, please put the following formula in your row and column created outside of the group SUM(COUNT(Fields!name_of_your_field.Value)) and you have the double entry table.
Let me know through the comments if you have any issues, I'll happy to help.
I have a sql server report, a rdlc, that generates a list of names with these columns:
Last | First | Middle
----------------------------
Last1 First1 Middle1
Last2 First2 Middle2
Last3 First3 Middle3
etc
Sometimes people like to put these really long company names in just the last name field. Is there a way I can have my rdlc expand the Last column to take over the other two columns?
Last | First | Middle
----------------------------
A Really Long Company Name
Last2 First2 Middle2
Last3 First3 Middle3
I would add an extra row below the existing row (in the same Row Group if any). In that row I would merge cells etc to get the required layout. Then I would add opposing Visibility expressions (e.g. based on the length of a field) to both rows, to control which is shown for each row of data.
I'm trying to create a report which has some interesting subtotals which I'm struggling with. Here's what I'm looking to create:
Col Group A (Currency)
Col Group B (Branch)
Row Group A (Account Group)
Row Group B (Open/Close Balance) Amount
Here's an example of what my data could look like:
CAD CAD USD
Main Div A Div B
Account Rec Open 100.00 50.00 25.00
Account Rec Close 123.00 50.00 35.00
Account Pay etc
What I'm trying to accomplish is blank columns after each Col Group without any page breaks. In this example after the CAD currency I'd like to have 4 blank columns to make some calculations (in some cases related to another dataset in the report). Is this possible?
Are you just looking to add some more columns to the Currency group, i.e. in the Designer this will look like:
With the end result like:
I've only added two columns here to keep the image from getting too complicated, but you can add as many as you like.
To do this, I just specified that a Group Footer be included when creating the Currency group, then added another column to the right of the footer row that was created.
Is this the sort of thing you're after?
I am building a report in report builder. I have 2 dataset, they can't be merged because of their complexity. What I would like to do is make a report where it use the ID from the first dataset to look up data in the 2nd dataset. Is this possible? The following are example, not exact code, but what I need:
First Dataset:
select itemID from Items
Second Dataset:
select itemID, saleAmount, salePrice from Sales
I would like to setup my report like this:
ItemID | Sale Count | Sale Price
--------------+-------------------------------------------------------------+------------
Items.itemID | sum(Sales.saleAmount) where items.itemID = Sales.itemID | sum(Sales.salePrice ) where items.itemID = Sales.itemID
So the end result will be like this:
ItemID | Sale Count | Sale Price
--------------+-------------------------------------------------------------+------------
1 | 11223 | $123123
2 | 4537 | $8375
Is this possible? Maybe with Conditional Lookup?
It's a shame you can't join the data when creating the datasets.
Failing that, I can think of a couple of other options:
Use LookupSet and custom code
This excellent answer How to combine aggregates within a group with aggregates across groups within SSRS has a perfect example of how you might do this.
Basically, you add custom code in a function (e.g. SumLookup) that accepts the results of a LookupSet call and returns the aggregated value. You'd have expressions like the following in your report:
=Code.SumLookup(
LookupSet(Fields!itemID.Value, Fields!itemID.Value, Fields!saleAmount.Value, "Sales")
)
I created a quick test and it works perfectly.
Use subreports
To do this you'd create table based on the Items dataset, then in the detail row you'd embed a subreport to display the Sales information.
The subreport would need an itemID parameter to filter the Sales appropriately, you would set the parent table to pass =Fields!itemID.Value to the subreport - this would then repeat for each itemID row and display the relevant Sales data.
For what it's worth, I'd look at the first option - there is some custom code, but it's straightforward, and that way you wouldn't need to deploy multiple reports. Just seems cleaner to me.