SSRS IIF Statement using dataset value

Jvan 1 Reputation point
2022-03-29T16:26:00.193+00:00

Hello,

I am trying to rename multiple table in a excel report using values from a dataset. I tried using the first below IIF statement but was thrown an error.

=IIf(First(Fields!ELIG_OTHER_ID1.Value, "DataSet1"),= "Child Health Assurance Pregnancy", "CHA Preg.",
IIf(First(Fields!ELIG_OTHER_ID1.Value, "DataSet1"),= "MEDICAID TANF EXPANSION MEDICAL - NNV", "TANF Exp. - No. NV",
IIf(First(Fields!ELIG_OTHER_ID1.Value, "DataSet1"),= "MEDICAID TANF EXPANSION MEDICAL - SNV", "TANF Exp. - SNV",
IIf(First(Fields!ELIG_OTHER_ID1.Value, "DataSet1"),= "NC Child Health Assurance Pregnancy - NO NV", "NC CHA Preg. - No. NV",
IIf(First(Fields!ELIG_OTHER_ID1.Value, "DataSet1"),= "NC Temporary Assistance Needy Family - NO NV", "NC TANF - No. NV",
IIf(First(Fields!ELIG_OTHER_ID1.Value, "DataSet1"),= "Temporary Assist Needy Family", "TANF", "ALL"))))))

I removed 'First' and 'Dataset1' and used the below statement but it names all the tabs the same "CHA Preg.". It doesnt seem to move to the next IIF statement.
=IIf(Fields!ELIG_OTHER_ID1.Value = "Child Health Assurance Pregnancy", "CHA Preg.",
IIf(Fields!ELIG_OTHER_ID1.Value = "MEDICAID TANF EXPANSION MEDICAL - NNV", "TANF Exp. - No. NV",
IIf(Fields!ELIG_OTHER_ID1.Value = "MEDICAID TANF EXPANSION MEDICAL - SNV", "TANF Exp. - SNV",
IIf(Fields!ELIG_OTHER_ID1.Value = "NC Child Health Assurance Pregnancy - NO NV", "NC CHA Preg. - No. NV",
IIf(Fields!ELIG_OTHER_ID1.Value = "NC Temporary Assistance Needy Family - NO NV", "NC TANF - No. NV",
IIf(Fields!ELIG_OTHER_ID1.Value = "Temporary Assist Needy Family", "TANF", "ALL"))))))

What is wrong with my first and second expression?

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,951 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,297 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Isabellaz-1451 3,616 Reputation points
    2022-03-30T01:26:31.703+00:00

    Hi @Jvan

    Why there is a comma before the equals sign? I think maybe the error is here, you can try to remove this extra comma.
    And in your situation you can also use switch function ,here is an example you can refer to:https://www.mssqltips.com/sqlservertip/6973/ssrs-iif-switch-choose-functions/
    188163-image.png

    Best Regards,
    Isabella


    If the answer is the right solution, please click "Accept Answer" and 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.

    0 comments No comments

  2. Olaf Helper 45,371 Reputation points
    2022-03-30T06:44:22.92+00:00

    but was thrown an error.

    And which error do you get ... or do we have to guess it?

    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.