# Can't divide this expression!!

• ### Question

• This expression is giving me problems.  I need to divide the whole thing by "/Sum(Fields!CurrentRoomNights)"

=Sum(VAL(IIF(Fields!BusinessType.Value = "Transient", (Fields!TotalAverageLOS.Value * Fields!CurrentRoomNights.Value), 0)))

Can someone help me?

Tuesday, February 13, 2018 6:10 PM

• `=IIf(Sum(val(Fields!CurrentRoomNights.value)) > 0 ,Sum(IIF(Fields!BusinessType.Value = "Transient", (val(Fields!TotalAverageLOS.Value) * val(Fields!CurrentRoomNights.Value)), 0))/IIf(Sum(val(Fields!CurrentRoomNights.value)) > 0 ,Sum(val(Fields!CurrentRoomNights.value)),1),0)`

Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog

• Marked as answer by Tuesday, February 13, 2018 7:03 PM
Tuesday, February 13, 2018 6:42 PM

### All replies

• like this?

`=Sum(IIF(Fields!BusinessType.Value = "Transient", (val(Fields!TotalAverageLOS.Value) * val(Fields!CurrentRoomNights.Value)), 0))`

Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog

Tuesday, February 13, 2018 6:26 PM
• I can get to this point, but how do I get this divided out by "/Sum(Fields!CurrentRoomNights)"?
Tuesday, February 13, 2018 6:33 PM
• `=IIf(Sum(val(Fields!CurrentRoomNights.value)) > 0 ,Sum(IIF(Fields!BusinessType.Value = "Transient", (val(Fields!TotalAverageLOS.Value) * val(Fields!CurrentRoomNights.Value)), 0))/IIf(Sum(val(Fields!CurrentRoomNights.value)) > 0 ,Sum(val(Fields!CurrentRoomNights.value)),1),0)`