SSRS Parameter with ALL In OUT

M224 21 Reputation points
2021-07-27T03:04:42.397+00:00

CREATE TABLE temp(
Name nvarchar(50),
Amount int)
Create a table and a parameter (named A) in report. Choose specify values in Available Values for parameter A. Add three values, type “ALL”,”IN” and “OUT” in both Label and Value textbox.
Create one more dataset (named DataSet2) to get all not null values. In our sample report, we put the text below into Query:
select * from temp where Amount is not null
Create one more parameter (named B). Select Allow multiple values and set Visibility Hidden. Set the data type same as the data type in your table (in our sample, Amount is integer). Select corresponding dataset and value field in Available Values (in our sample is DataSet2 and Amount).
Create a filter in your Tablix Properties.
Expressions: =Fields!Amount.Value
Operator: In
Value: =iif(Parameters!A.Value="ALL",Fields!Amount.Value,iif(Parameters!A.Value="IN",nothing,Parameters!B.Value))
Save and preview. The result looks like below:

Any ideas?

Many thanks
M224

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,923 questions
{count} votes

8 answers

Sort by: Most helpful
  1. M224 21 Reputation points
    2021-07-27T06:24:48.607+00:00

    118129-capture.jpg

    0 comments No comments

  2. Joyzhao-MSFT 15,586 Reputation points
    2021-07-27T07:03:12.54+00:00

    Please refer to my steps below:


  3. Joyzhao-MSFT 15,586 Reputation points
    2021-07-27T08:00:28.23+00:00

    Hi @M224 ,
    I did some tests.This is the effect you want:

    118251-15.gif
    I modified on your basis:
    ParameterA:

    118149-paraa01.jpg
    118252-paraa02.jpg

    ParameterB:

    118189-parab01.jpg
    118190-parab02.jpg

    Filters on Dataset 1:

    118233-dataset1-filters.jpg

    The expression here is:

    =IIf(Parameters!A.Value="1",Fields!Amount.Value,iif(Parameters!A.Value="3",nothing,Parameters!B.Value))  
    

    Hope this helps.
    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  4. M224 21 Reputation points
    2021-07-27T23:05:33.927+00:00

    Hi Joy,

    This is what I'm trying to archive.

    118434-1.jpg


  5. M224 21 Reputation points
    2021-07-27T23:35:11.273+00:00

    the issue I'm facing with the proposed expression is that if I select "IN" it will give a bank result instead.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.