Sum

  • I am trying to Display the 3 values

    =SUM(IIF(Fields!Employee.Value = "FullTime",1,0),"Production") --- This will give the sum of Fulltime employees

    = SUM(IIF(Fields!Employee.Value = "Partime",1,0),"Production")---- This will give the sum of Part Time employees

    = Count(Fields!Employee.Value,"Production")--- This will give a count of all employees

    This returns correct result if there is a value coming in. But there are parameters passed where the Qyery returns no records , That means the Fields!.Employee value doesn't return any thing and the count of the row is zero. I can execute the query in SMS and see that no rows are displayed. I want to display "0" if there are no rows coming in but instead the entire tablix disappears.

    Can anyone advise what changes should I make to the expression?

  • Would something like this work?

    =IIF(Fields!Employee.Value Is Nothing, "0", SUM(IIF(Fields!Employee.Value = "FullTime",1,0),"Production") ) --- This will give the sum of Fulltime employees

    =IIF(Fields!Employee.Value Is Nothing, "0", SUM(IIF(Fields!Employee.Value = "Partime",1,0),"Production") )---- This will give the sum of Part Time employees

    =IIF(Fields!Employee.Value Is Nothing, "0", Count(Fields!Employee.Value,"Production") )--- This will give a count of all employees

  • doug.brown (3/13/2014)


    Would something like this work?

    =IIF(Fields!Employee.Value Is Nothing, "0", SUM(IIF(Fields!Employee.Value = "FullTime",1,0),"Production") ) --- This will give the sum of Fulltime employees

    =IIF(Fields!Employee.Value Is Nothing, "0", SUM(IIF(Fields!Employee.Value = "Partime",1,0),"Production") )---- This will give the sum of Part Time employees

    =IIF(Fields!Employee.Value Is Nothing, "0", Count(Fields!Employee.Value,"Production") )--- This will give a count of all employees

    This won't work because SSRS will not attempt to do anything with the tablix if there are no rows in the associated dataset.

    You can configure the "NoRowsMessage" of the tablix but I suspect that this won't do what is needed.

    I think that you will need to change the SQL code you are using so that there is at least one record returned. If that record contains values that are not included in the SUM expressions (i.e. the IIF statements return 0), that will work OK. The employee count expression would need to be changed to exclude that record.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply