Filter Tablix with LIKE and OR

Dom 836 Reputation points
2023-08-22T16:15:47.6533333+00:00

With SSRS, I need to filter a tablix with a LIKE and an OR condition. For example:

WHERE MedCampaign LIKE AffCPD_1224* OR MedCampaign LIKE AffCPD_1225*

I tried the below suggestion I found, but this just returns the entire dataset. How should I go about this?

User's image

Also tried this suggestion:

Expression: iff(InStr(Fields!MedCampaign.Value, "AffCPD_1224") > 0 or InStr(Fields!MedCampaign.Value, "AffCPD_1225") > 0,1,0)

0

Again, returns ALL values.

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,942 questions
0 comments No comments
{count} votes

Accepted answer
  1. AniyaTang-MSFT 12,446 Reputation points Microsoft Vendor
    2023-08-23T02:28:05.5933333+00:00

    Hi @Dom

    I did a simple test and here is my source data.

    Screenshot 2023-08-23 102337

    Then I used this expression in Tablix filter:

    =IIF(Fields!MedCampaign.Value like "AffCPD_1224*" OR Fields!MedCampaign.Value like "AffCPD_1225*",1,0)
    

    Screenshot 2023-08-23 102416

    Result:

    Screenshot 2023-08-23 102450

    Hope this helps you.

    If the answer is useful, please click Accept Answer to let others with similar questions quickly find answers. If you have any questions, please feel free to let me know.

    Best regards

    Aniya

    7 people found this answer helpful.

0 additional answers

Sort by: Most helpful

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.