bob
bob

Reputation: 31

join two separate parameter into one

I have SSRS report containing two separated parameter. One passing Category and second one value. And I have one field in the report for category. How to join these two separated parameter and field of the report

Parameter example

Category--ABC,DEF
Value   --1,2

SSRS Report has fields Category ABC, DEF, and later I need to do calculation

if category = ABC then value*xxx
                  1*XXX

How to use two separated parameter values in one and then use in report?

Upvotes: 1

Views: 54

Answers (1)

Alan Schofield
Alan Schofield

Reputation: 21758

It's difficult to answer as your question is not very clear but I will assume the following....

  1. You have a database table a myCategory column and a myValue column
  2. You have a parameter called pCategory which is multi-value
  3. You have a parameter called pValue which is a single value parameter.

Your dataset query would them be something like

SELECT 
    myCategory
    , myValue * @pValue as myNewValue
    , myOtherColumns
FROM myTable
WHERE myCategory IN (@pCategory)

If you choose both "ABC" and "DEF" from the first parameter and "2" from your second parameter then the query that SSRS will send to the server will be

SELECT 
    myCategory
    , myValue * 2 as myNewValue
    , myOtherColumns
FROM myTable
WHERE myCategory IN ('ABC', 'DEF')

Upvotes: 1

Related Questions