Visual studio Case Statement in Expression Builder

Dom 371 Reputation points

Have an rdl where I filter the report based on a parameter selection. I filter the data in the report in the Tablix. I also have a placeholder in the report header where I display a calculation. However, I want to also filter this calculation based on the parameter selection. I'm trying to use a case statement, but can't get the syntax right in expression builder. Advice?

=Sum(Fields!CodeInstances.Value, "CodeReport")
=case when [@selection] = [datavalue] then 
Sum(Fields!CodeInstances.Value, "CodeReport") else NULL end
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,362 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AniyaTang-MSFT 5,631 Reputation points Microsoft Vendor

    Hi @Dom

    I did a simple test, just using Sum(Fields!xxx.Value, "DataSet") can filter out unselected data based on parameters.

    But if your report is not possible, you can combine Sum with the IIF function. I set the Month as a parameter in the test and then use an expression like below. The expression means that when the parameter Month is the same as the value of the field Month, the value will be recorded in Sum, otherwise it will be counted as 0.




    Best regards,