Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dsarangaya
Contributor
Contributor

Help Nested IF statement newbie

Hi Everyone,

i'm having trouble with this one.  i bet this is a piece of cake for most of you.   

CategoryDelivery time
Apple3 days
Orange12 days
Apple6 days
Orange15 days
Apple2 days
Orange9 days

 

I need to show how many late deliveries were there for both categories assuming that a late delivery for category Apple is more than 5 days and category Orange is more than 9 days.  how do i write that in an expression?

2 Solutions

Accepted Solutions
ChiragPradhan
Creator II
Creator II

Use category as your dimension and the below expression.

Count(if(Category='Apple' and SubField([Delivery Time],' ',1)>5, 1,
		if(Category='Orange' and SubField([Delivery Time],' ',1)>9,1)
        )
     )

 

View solution in original post

dsarangaya
Contributor
Contributor
Author

Thank you so much.  This works perfectly.

View solution in original post

4 Replies
Simon_Astakhov
Partner - Contributor III
Partner - Contributor III

If you need to solve it in expression:

count( {<[Category]={"Apple"},[Delivery time]={">5"}>+<[Category]={"Orange"},[Delivery time]={">9"}>} [Delivery time] )

 

JordyWegman
Partner - Master
Partner - Master

Hi,

Set your Dimension as Category and use the following formula as Measure:

 

Count(IF((Category = 'Apple' and [Delivery time]>5) OR (Category = 'Orange' and [Delivery time]>9),[Delivery time],null())

// If you really have '5 days' like with text then use this:

Count(IF((Category = 'Apple' and SubField([Delivery time],' ',1)>5) OR (Category = 'Orange' and SubField([Delivery time],' ',1)>9) ,[Delivery time],null()))

 

Jordy

Climber

Work smarter, not harder
ChiragPradhan
Creator II
Creator II

Use category as your dimension and the below expression.

Count(if(Category='Apple' and SubField([Delivery Time],' ',1)>5, 1,
		if(Category='Orange' and SubField([Delivery Time],' ',1)>9,1)
        )
     )

 

dsarangaya
Contributor
Contributor
Author

Thank you so much.  This works perfectly.