I have a matrix like below. years on columns and countries on rows.
Countries 2001 2002
US 100 400
UK 200 290
IR 300 89
I have a requirement of creating a subreport which shows Invoice details. When I click 100 (US-1002) on my main report I have to show all the 100 Invoices. I tried this way:
Since I am doing count for InvoiceID in matrix, I tried using Join(Fields!InvoiceID,", ") expression on the data test box action(Go to report). On the other side I created a subreport with multivalue parameter. But this approach dint work. I found that Join will not work with data rows as it expect arrays.
Later I used Join(LookupSet(1,1,Fields!Name.Value, "DatasetName")," / "). I could join the invoice ids but the problem is , this expression joins all the invoice ID in complete dataset. I just need US-2001 cell (100) invoice ids only to take to my subreport
From your description, it sounds like the easiest thing to do would be to set up the subreport to take two parameters, Country and Year, instead of trying to pass the list of invoices.
The subreport can then report all the invoices for a particular Country and Year combination.
It would be simpler to just set up the drillthrough to accept the two fields for its parameters, as above, instead of try to work out an expression for all the invoices in a particular cell's scope.
Related
I'm creating a new report where one of my flags as to do with the Taxes we have here in Quebec. In this report, I'm displaying invoices with a header, the details (items) and then the total with the taxes.
Now here in Quebec we have TPS and TVQ as taxes. Sometimes, when we sell outside of the Quebec area at one of our other branch, we wont have the TVQ.
The goal of my flag, is to turn the textbox red when TPS is there and TVQ isn't there. I also want to do the same thing if TVQ is there and TPS isn't.
I kinda feel like it should look a little like that
IIF ((Fields!TAXDLID.Value = "TPS") AND (Fields!TAXDLID.Value = "TVQ"), black, red)
but I can't wrap my head around.
Thanks for the help!
edit:
Here is something that works and doesn't need red flags
Here is something that also works and doesn't need red flags
Here is something that does not work and would need a flags since it doesn't have TVQ
It's also possible to have nothing in the section
It's not perfectly clear what your dataset looks like (from your dataset query) so I have made some assumptions as follows:
Each row in your dataset has a Column that is either 'TPS' or 'TVQ'
Your dataset only contains data for a single invoice per report.
Your main report dataset is called dsMain
Assuming 1 invoice per report
Assuming the above, as your column can only contain one of two values we can simple count how many unique values are in the dataset.
You can do something like this
=IIF(CountDistinct(Fields!TAXDLID.Value,"dsMain") >1, "Black", "Red")
More than one invoice per report
If you are producing more than one invoice per report then I would imagine you have a row group setup that groups by invoice number. If this row group is called grpInvoice then you need to swap out the dsMain scope expression for the name of your row gorup
e.g.
=IIF(CountDistinct(Fields!TAXDLID.Value,"grpInvoice") >1, "Black", "Red")
Note
The scope name MUST be the exact spelling of the row group name or dataset name, it is case sensitive AND is must be enclosed in quotes as per the example.
If this does not help, please provide a sample of the data that comes from your dataset query and your report design including grouping info where applicable.
I have a report having two tab-lix and also two data set(e.g=dataset1,dataset2) for each tab-lix. When i am generating report by passing the multiple parameter location id(38,39 & 40) value if there is no record of id-38 in dataset2 i want blank space but in my report it is showing report of 39. But i want if there is no data in data set based on the parameter it is showing only blank space.Because always dataset1 having data and so it showing properly.When i am generating report with multiple parameter(38,39,40) it showing tablix1 of 38 parameter but tablix2 of 39 parameter in on page because of there is no data in dataset2 of 38 parameter.So i want to display a blank space on behalf of tablix2 if there is no data.
Give me a solution.
This answer assumes you have a table that contains all locations e.g. DimLocations, if not you should consider creating one.
You can then change your dataset query to be something like.
SELECT loc.LocationID, t.SomeColumn, t.AnotherColumn
FROM DimLocations loc
LEFT JOIN myTable t ON loc.LocationID = t.LocationID
WHERE loc.LocationID IN(#myLocationParameter)
This will ensure that you get a record for each location as long as it appears in the DimLocations table.
If this does not help, edit your question to show the dataset query you are using now and the structure of your locations table (if you have one)
I am new to SSRS. I have a report that goes like this
Type Amount
A 500
B 200
A 100
C 400
C 200
I want to convert this to a report like this
Type Total Amount
A 600
B 200
C 600
Basically get distinct Types on the left column and th totals for those types in the right column. Is there a way i can do that easily?
Thanks
Starting with you simple report which just lists the records in your DataSet:
Design:
Results:
Right click on (Details)in the Row Groups section and choose Add Group -> Parent Group:
Choose the field you want to group by (Type in our example) from the Group by: dropdown, choose to add either a group header or footer and click OK:
Your table will now look something like this:
You can delete the second column and the third row - or second row if you chose to add a group footer earlier - entirely (clicking OK when deleting the row and being prompted to delete the associated group), leaving a layout like this:
Now just click the field selector for the empty cell in the table and choose your Amount field:
or right click on the empty cell, choose Expression from the context menu and enter the following expression:
=Sum(Fields!Amount.Value)
either of which should result in the formula being placed into the cell:
Now run your report and you should get the expected result:
There's loads of places online with similar guides and resources which you can also consult:
MSDN Reporting Services Tutorial (Adding Grouping and Totals)
MS TechNet (Calculating Totals and Other Aggregates)
MSDN (Add a Total to a Group or Tablix Data Region)
There are also several other similar questions here on SO which you'll find if you just search for them.
I inherited a report where the Grouping and Aggregation is done in the Report. The Dataset is a SQL Server 2008 Query.
This raw Data:
ID Budget Amount Spent Amount
A 1,500 20
A 1,500 20
A 1,500 60
B 2,000 50
B 2,000 75
B 2,000 75
Shows like this on the report:
ID Budget Amount Spent Amount
A 1,500 100
B 2,000 200
I added a calculated field to the Report to get this:
ID Budget Amount Spent Amount Balance
A 1,500 100 1,400
B 2,000 200 1,800
Can I do something in the report to exclude rows that have a balance less than 1,500?
If not, what are my other options?
****************************
. . . the next day . . .
Having tried suggestions to add a Filter Exp. to the Tablix and a Row Visibility Exp. to the row - unsuccessfully - here is what I found:
My actual report has two Row Groups on the row for which I want to limit the rows that show.
I tried the same suggestions made in this thread on another report [with no Row Groups] ... and the Tablix Filter and the Row Visibility both worked fine.
I have to assume that the fact that my 'problem' report has two levels of Grouping is the cause of the Expressions not working.
BUT . . . is there a way to overcome this?
****************************
I just realized [while researching this same issue elsewhere] that the report I am working with does not have a 'Details' row.
What I was thinking of as a Details row is not. There is no Details Row in this report. I have been trying all your suggestions on a row that is not a Details row.
You can reference a textbox field in your report, per the comments in the thread:
=IIF(ReportItems!textbox1.Value <= 1500, True, False)
Throw this expression in the row details visibility section. Or you can even use the filters section to filter this data out. Tons of ways to do this.
Thanks for all your suggestions. They helped me arrive at a solution.
As I said in my [edited] post, my report has no Details Row.
I was adding the expression to the Visibility Property of the Row on the report Tablix which was not a Detail row.
After reading the topic here:
https://dba.stackexchange.com/questions/53727/how-to-hide-rows-in-ssrs-report
I did this:
-> Right-clicked the last/lowest of the Row Groups in the Groups pane,
-> Group Properties,
-> Visibility,
-> Show or hide based on an expression &
-> Entered this expression [does not relate exactly to my example in the post]:
=IIF((Avg(Fields!AMOUNT_1.Value) - Sum(Fields!AMOUNT_2.Value)) >= 0, True, False)
It is now working exactly as needed.
Thanks for all your input!
This question already has an answer here:
Link Subreport to matrix
(1 answer)
Closed 9 years ago.
I a matrix which shows count of Invoices (InvoiceID) with countries on rows and years on headers
Country 2001 2002
US 100 300
UK 200 400
IR 500 90
I have requirement of creating a subreport which shows Invoices details. When I click 100(US-2001) on my main report I have to show all the 100 Invoices. I tried this way: since I am doing count of InoviceID in matrix, I tried using Join(Fields!InvoiceID,", ") expression on the data text box action (Go to report). on the other side I created a subreport with multivalue parameter. but this approach dint work. Later I discovered that Join will not work rows as it expects only arrays.
later I used Join(LookupSet(1,1,Fields!InvoiceID.Value, "DatasetName")," / ") I could join the invoice ids but the problem is, this expression joins all the invoice ID in complete dataset. I just need US-2001 invoices to take to my subreport.
Your subreport should have two parameters:
#Year
#Country
With those two parameters, the subreport can find the clicked invoices. For example, if the following values are passed:
#Year = "2001"
#Country = "UK"
Then it should be able to find those "200" invoices and display their details.
If you base both the main report (that shows COUNT(InvoiceID) and the subreport (that shows Invoice.* details) on the same view, you're pretty safe in getting consistent results in both reports.
With the "Go to subreport" action you should be able to fill those parameters.