Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

IIF Condition Expand / Collapse
Posted Wednesday, May 7, 2014 2:03 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 22, 2014 9:55 PM
Points: 30, Visits: 98
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

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

Any help is highly appreciated.


Post #1568316
Posted Wednesday, May 7, 2014 10:18 AM



Group: General Forum Members
Last Login: Yesterday @ 3:08 PM
Points: 10,808, Visits: 14,834
I think this is what you need:

IIF(Fields!STypeName.Value <> "SS" AND Fields!STypeName.Value <> "UA",
SUM(Fields!VDuration.Value + Fields!SDuration.Value))

This does:

IF Fields!STypeName.Value is not equal to "SS" or "UA" THEN
return ROUND(((Fields!SDuration.Value/2)/60), 2)
return ROUND((SUM(Fields!VDuration.Value + Fields!SDuration.Value)/60), 2)

Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1568577
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse