ChikisTrikisAlan
ChikisTrikisAlan

Reputation: 3

SSRS Expression issues

I'm trying to write an expression in SSRS but I keep getting the error message below:

"Textbox1 uses a first, last or previous aggregate in an outer aggregate. These Aggregate functions cannot be specified as nested aggregates"

What does this mean?

All I'm trying to do is to write an expression that will:

count the number of cards where the activation date <=period_start_date AND (Deactivation date is null OR Deactivation Date >=period_start_date)

This is how my expression looks:

=Count(
        IIF(
            (First(Fields!CUBD_CareDay_activate_DT_SHORT.Value, "DataSet1")<=First(Fields!CUBD_CareDay_Period_Start_DT_SHORT.Value, "DataSet1"))
            AND
            ( 
              First(Fields!CUBD_CareDay_deactivate_DT_SHORT.Value, "DataSet1")=""
              OR
              (First(Fields!CUBD_CareDay_deactivate_DT_SHORT.Value, "DataSet1")>=First(Fields!CUBD_CareDay_Period_Start_DT_SHORT.Value, "DataSet1"))
            )
  ,Fields!CUBD_CareDay_Unit_ID.Value
  ,0
  )
)

Any ideas or tips?

Upvotes: 0

Views: 1763

Answers (1)

Daniel Hanczyc
Daniel Hanczyc

Reputation: 182

Please see code below: let me know if it works or what is the error message:

=Count(
        IIF(
            ((Fields!CUBD_CareDay_activate_DT_SHORT.Value)<=Fields!CUBD_CareDay_Period_Start_DT_SHORT.Value))
            AND
            ( 
              (Fields!CUBD_CareDay_deactivate_DT_SHORT.Value)=""
              OR
              ((Fields!CUBD_CareDay_deactivate_DT_SHORT.Value)>=(Fields!CUBD_CareDay_Period_Start_DT_SHORT.Value))
            )   ,Fields!CUBD_CareDay_Unit_ID.Value   ,0   ) )

Upvotes: 1

Related Questions