snp.it
snp.it

Reputation: 522

Greater than and Less than Value SSRS 2008

I have a parameter Total. I want to be able to get records greater than a Particular Value and /or less than a particular value.

So How can I define that in the parameter and What do I write in the Dataset.(Total = (@Total))or
Total in(@Total))

Thank you

Upvotes: 1

Views: 5056

Answers (1)

Anup Agrawal
Anup Agrawal

Reputation: 6669

One way is define two parameters @startTotal and @endTotal. When creating parameters make sure to check allow Null values.

In your dataset query

Where (Dataset.Total >= @startTotal or @startTotal is NULL) 
    AND (Dataset.Total <= @endTotal or @endTotal is NULL)

If the user wants Total of greater than 50. User will enter @startTotal = 50 and wont enter anything in @endTotal. It will show all values greater than or equal to 50

If the user wants Total of less than 50. User will won't enter anything in @startTotal and enter the value of 50 in @endTotal. It will show all the values less than or equal to 50.

Make sure you either allow Nulls or blank value. If you are allowing blank then your query will be changed accordingly.

Where (Dataset.Total >= @startTotal or @startTotal = "") 
    AND (Dataset.Total <= @endTotal or @endTotal = "")

In the report parameter Prompt you can put the follow values

For the @startTotal set the Prompt to Total >=

For the @endTotal set Prompt to Total <=

HTH.

Upvotes: 3

Related Questions