Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

IIF Condition Expand / Collapse
Author
Message
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
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.

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


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:54 AM
Points: 10,340, Visits: 13,338
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)




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

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