WHERE statement in an expression
I am relativly new to SSRS and need help with building a report and understanding how to work with the parameters in expressions. I have defined two parameters. The first parameter is defined in the dataset to return the records that match a specific value. The report needs to always show all of the items returned by the first parameter. SELECT Column1, Column2, Column3 FROM Table1 WHERE Column3 = @SpecifiedValue The second parameter is defined in the report as a DateTime. I am trying to use the second parameter to return the values that match a date column in order to calculate how much of the product has been received. If nothing has been received then the value is shown as zero. I am using a table to layout the report. The basic logic I need to apply somehow to a specific textbox within the table is SUM(Fields!Totals.Value) WHERE Fields!Date.Value <= Parameters!ReportingDate.Value How would I create this in an expression? or do I have to approach this from a different direction?
June 22nd, 2011 10:34pm

To me this sounds like you can better achieve applying the logic in your SELECT statement to produce the correct DataSet.For every expert, there is an equal and opposite expert. - Becker's Law My blog
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2011 10:49pm

Hi Aversatz, Based on your requirement, you can try to add a filter on your dataset which is based on the condition(Fields!Date.Value <= Parameters!ReportingDate.Value) to retrieve data. After that, you can use the Sum() function to calculate the product quantity. Here are the steps to add a filter on the dataset: 1. In the design surface, right-click on your dataset and select “Dataset Properties”. 2. Click “Filters”, and then click “Add” button. Set the filter like this: Expression: Fields!Date.Value Operator: <= Value: Parameters!ReportingDate.Value 3. Fill in the expression in the textbox to calculate the values: =IIF(IsNothing(Sum(Fields!Totals.Value)),0,Sum(Fields!Totals.Value) For more information about Add a Filter (Reporting Services), please refer to the article below: http://msdn.microsoft.com/en-us/library/ms156270(v=sql.110).aspx If you have any more questions, please feel free to ask. Thanks, Bin Long
June 24th, 2011 1:04am

Sorry about the delayed response. Thank your for your help. This pointed me in the right direction. Aversatz
Free Windows Admin Tool Kit Click here and download it now
June 28th, 2011 11:34am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics