Forum Discussion

Spikenaylor's avatar
Spikenaylor
New Member
1 year ago
Solved

Report Builder filtering table based off another table parameters

Hi all I am building my report and my have my parameters working on the main table i am using, report works fine. My main table has two columns in that I am interested in. Prep_Month and Completion...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi,Spikenaylor . I am glad to help you.
    If you use the Filters function to filter the dataset, the system selects the parameter with a (0) suffix by default.


    If this is the case for you, you need to remove “(0)” and make the whole parameter a list of values, so that the corresponding data can be filtered properly (I think there is an error in your parameter configuration settings)


    this is my test data:

    If you want to implement a similar join query (or more complex query logic for datasets, I'd prefer that you write the query statement artificially)
    Using query statements + query parameters

    Tutorial: Add parameters to your report (Report Builder) - SQL Server Reporting Services (SSRS) | Microsoft Learn

    Like this:
    Set up a separate parameter value dataset for the report parameters to get the corresponding parameter values.
     

    The dataset DataSetMainTablePar used by the parameter [MonthCompleted]

    SELECT
    DISTINCT
    MainTable.Completion_Month
    FROM
      MainTable

     

    This is then used in the final dataset to set the correct query parameters

    I'm using a SQL Server datasource

    You need to ensure that:

    1. the parameters are set up with the correct type, whether they contain multiple values, (use “=” or “IN” in the query)
    2. the parameter mapping is set correctly
    3. Query parameters are used correctly in the query statement



    This is my query code:

    SELECT d.*
    FROM DeliveryTable d
    JOIN MainTable m ON d.Delivery_Month = m.Prep_Month
    WHERE m.Completion_Month in ( @MonthCompleted );

    I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
    Best Regards,
    Carson Jian,
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.