IIF Condition

  • Hi Team,

    I need some assistance with the following

    I have an IIF condition and it is as follows

    =round((Sum(Fields!VDuration.Value) + sum(iif(not(Fields!STypeName.Value = "SS") and not(Fields!STypeName.Value = "UA "), Fields!SDuration.Value,0)))/ 60,2)

    I want to change the above to as

    > If the Stypename.value<> "SS" and Stypename.value <> "UA", then Vduration should not be calculated and the Sduration needs to be half which means sum( Vduration = 0 and Sduration = Sduration/2) ELSE

    sum(Vduration+Sduration)

    Please note :- both the duration are in minutes, thats why the above script has ROUND condition.

    Any help is highly appreciated.

    Regards,

    Krishna.

  • I think this is what you need:

    =Round(

    (

    IIF(Fields!STypeName.Value <> "SS" AND Fields!STypeName.Value <> "UA",

    Fields!SDuration.Value/2,

    SUM(Fields!VDuration.Value + Fields!SDuration.Value))

    /60

    )

    ,2)

    This does:

    IF Fields!STypeName.Value is not equal to "SS" or "UA" THEN

    return ROUND(((Fields!SDuration.Value/2)/60), 2)

    ELSE

    return ROUND((SUM(Fields!VDuration.Value + Fields!SDuration.Value)/60), 2)

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

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