How to compare 2 expressions in SSRS and hide row based on that?

Anjali Shah 21 Reputation points
2022-05-10T11:44:53.27+00:00

I have a table with 2 rows having 2 different expressions.
200596-image.png

I want to hide the second row if its value matched with the expression of 1st row. How do I achieve the same?

I tried something like IIF(EXP1=EXP2,TRUE, FALSE) in the visibility expression of 2nd row but it didn't work.

Thanks in advance.

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,860 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Isabellaz-1451 3,616 Reputation points
    2022-05-11T01:49:20.963+00:00

    Hi @Anjali Shah

    I did a local test,and mine can works.

    expression: =iif(ReportItems!SECONDROW.Value=ReportItems!FIRSTROW.Value,True,False)
    SECONDROW and FIRSTROW is the name of the two textbox
    200727-image.png

    Best Regards,
    Isabella

    0 comments No comments

  2. Joyzhao-MSFT 15,571 Reputation points
    2022-05-11T02:51:37.35+00:00

    Hi @Anjali Shah ,
    I tested this locally and if you use something like =IIF(Your EXPR1=Your EXP2,TRUE,FALSE) this will work fine.
    At first I have the following Table,

    200718-01.jpg

    I set up two expressions:

    =COUNT(Fields!CaseID.Value)  
    =IIF(COUNT(Fields!CaseID.Value)=8,8,0)  
    

    The preview is as follows:
    200813-00.jpg

    When I set the visibility to the second expression textbox:

    =IIF(COUNT(Fields!CaseID.Value)  
    =  
    IIF(COUNT(Fields!CaseID.Value)=8,8,0),True,False)  
    

    200758-02.jpg

    The preview is as follows:

    200805-03.jpg

    When the value of the second expression is the same as the value of the first expression, the second value is hidden.

    Best Regards,
    Joy


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.