4 Replies Latest reply: Mar 19, 2018 11:21 AM by Michael Gauntlett

# Sum(if(

Hi Guys,

I have

SUM(IF((IF(IsNull(AARO_Booking_Period) and IsNull(Status),'R0',If (IsNull(Status),'R1',Status)))='R0',1,0))

which sums the total for a set tollgate in this case R0 as underlined.

the R tollgate will either come from the IF statement:

IF(IsNull(AARO_Booking_Period) and IsNull(Status),'R0',If (IsNull(Status),'R1',Status))

or from the Status field itself.

This works for R0 and R1 when I change the underlined but not for any other.

I have tried sum(IF(Status='R2' etc. but this also does not work any Ideas?

As always greatly appreciated.

• ###### Re: Sum(if(

You want to count when Status is R2? May be this

Count({<Status = {'R2'}>}Status)

• ###### Re: Sum(if(

Hi Sunny,

Afraid Not,

so for the 4 possible outcomes R0, R1, R2, R3.

The R0 & R1 will solely come from the IF statement:IF(IsNull(AARO_Booking_Period) and IsNull(Status),'R0',If (IsNull(Status),'R1',Status))

whereas the R2 & R3 will come from the status field which comes from an attached file.

I use the above IF as a master measure 'Master status'

• ###### Re: Sum(if(

You can probably look at using the Aggr function

Sum(Aggr(if(condition_true,1,0) , Dimension))

• ###### Re: Sum(if(

Afraid not @Vishnu_Chakravaram