SSRS Dataset get a row based on specific criteria - reporting-services

I have a dataset called Box as below:
Dataset Called Box
I am trying to rewrite this Crystal Reports command If {Name} like "Train*" Then
{volume} in SSRS as =IIf(Fields!NAME.Value="Train", Fields!VOLUME.Value, Nothing) or =IIf(Left(Fields!NAME.Value,3)="Tra", Fields!VOLUME.Value, Nothing) I need to get the last value 9977, but I cannot use Last function in SSRS, as the order might change.
Please suggest.
Thanks.

Related

SSRS IIF Expression across Multiple DataSets

I'm trying to do an IIF expression on a 2nd dataset to sum the 'BookingsComfirmed2016LASTWEEK' column and then divide it by the sum of the 'Stock2016Week' column in the dataset I'm in and where the PropertyTypeCategory = Cottage, but with no joy. I'm sure it's something to do with the placement of the 2nd dataset name, but would appreciate any help. Regards Claire
Dataset1 = TradingLastWeekandYTD
Dataset2 = TradinglastWeekandYTDSTOCK
=(IIF(Fields!PropertyTypeCategory.Value, "TradingLastWeekandYTD" = "Cottage",Sum(Fields!BookingsConfirmed2016LASTWEEK.Value, "TradingLastWeekandYTD")) /(IIF(Fields!PropertyTypeCategory.Value = "Cottage", Sum(Fields!Stock2016Week.Value)),0)
Your iif() won't work like this.
You can't check row by row in a dataset you're not currently working in, which is what you are trying to do with the first part of the iif().
You can use custom code to do an aggregated lookupset() to get the values of the first part.
This link https://itsalocke.com/aggregate-on-a-lookup-in-ssrs/ will help you do the custom code.
For the lookupset(), you would have to do something like..
=Code.SumLookup(lookupset(Fields!PropertyTypeCategory.Value, "Cottage", Fields!BookingsConfirmed2016LASTWEEK.Value))
This assumes that your custom code function is called "SumLookup". It will sum all the values that the lookupset() returns.

Dynamic groupings using IIF with multiple datasources

I'm using report viewer and trying to create dynamic groupings on my table. Before the report is generated, I have a popup that ask if the report generated should be grouped by category or not.
I have two datasets, one called ReportParameterDTO and the second is called LoanDTO
The tablix is connected to the dataset LoanDTO. I want to create a parent grouping expression for that tablix such that if the first value of ReportParameterDTO.GroupByCategory is true, then it should group, otherwise do nothing.
What I tried
=IIF(First(Fields!GroupByCategory.Value, "ReportParameterDTO") = true, Fields!Category.Value, ""))
It gives me back and error around Fields!GroupByCategory.Value and the error within the error list states that A group expression for tablix includes an aggregate function.
The IIF Expression will compile if I use Field Values from LoanDTO but I don't want to do that.
Add a new parameter.
Set it to Internal.
Set the Available Values to pull from the ReportParameterDTO dataset and the Value field will be GroupByCategory.
Also set the Default Values to pull from the ReportParameterDTO query.
Now you can refer to this internal parameter in your grouping expression like so:
=IIf(Parameters!GroupByCategory.Value = True, Fields!Category.Value, Nothing)
You can create both table and whit your parameter show or hide the table visibility. So like this I think is going to be more easy for you to set up your table and groups.

Microsoft access report sum function

I have a report contain sub report on Microsoft Access database.
I want to sum column in a report and sum another column in a sub report
and sum the result from the two columns in a label.
When I try to sum column in a report using expression -> =sum([outcome])
it show #error in the sum textbox.
Somebody help me please.
Are you adding the calculation in a Header/Footer
http://www.599cd.com/tips/access/form-footer-total-sum/
Edit
Could wrap it in an NZ
=NZ( value, valueIfNull )
https://599cd.com/glossary/access/nz/
Try a DSUM
Tip
https://www.599cd.com/tips/access/130809-dsum/
Glossary
https://www.599cd.com/glossary/access/dsum/

SSRS Report Parameter Available Values setting

I am trying to set Available Values on SSRS Report Parameter properties.
I wish I can add some images but I do not enough reputation.
When I select 'Get values from a query', I don't have problem.
However, I get this message when I am trying to use 'Specify values'
"Field cannot be used in report parameter expressions."
I am using following expression. Any help would be appreciated.
=First(Fields!EventCode1.Value, "History2")
You cannot use the same dataset "History2" as a field (column in report design) and as well as in parameter list. Create a different dataset with the required value and use that in parameter.

Parameter missing a value

I am new to reporting services and have a reporting services 2005 report that I am working on to use as a base report template for our organization. I am trying to place the date that the report was last modified on the report server into the page header of the report. However, I keep getting a 'ParamX' parameter is missing a value error when I try to This is what I have done:
Set up a Parameter ReportName with a default value of Globals!ReportName. It is also hidden and internal.
Set up a Dataset ReportHeader that calls a stored procedure that returns the date the report was last updated or another date, if the report is not on the report server. It has a parameter #ReportName assigned to the Parameter!ReportName.Value. The Dataset returns values when run on the dataset tab in the BI tool.
Set up a Parameter ReportVersion that has a default value Query From based on the dataset ReportHeader and picking the ModDate column. It is the last parameter in the report parameters list.
I assign a textbox to the parameter.
When I preview, I get "The 'ReportVersion' parameter is missing a value whether I place it in the report body or page header (which is where I want it). I have deleted and added the parameter again, toyed with the hidden and internal settings on it.
What does this error really mean, what I am missing, and can I even do this with parameters?
Thanks In Advance
Jim
If I understand what you're doing, it sounds like you want to be using a field where you're implementing a parameter...
You are returning the ModDate from the data source, correct? If you're doing this, you can simply throw a text box in there, and use something like this: =Fields!modDate.Value to display it.
Parameters are values that go in to the query, fields are what it returns.
Hope this helps...
EDIT:: OK so are you trying to retrieve the mod-date column value from the reportserver db? If that's what we're talking about, you'll need to add a few things to the report. Add a datasource to report db, a dataset containing the date (query below), a list object in the report linked to the dataset, and a textbox in said list object to display the field. If you hit the report server with a query like this:
SELECT MAX(ModifiedDate) AS ModDate FROM catalog WHERE name='myReportName'
That will return your modifieddate from the ReportSErvices Database as a field that you can use.