Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My field name is Expense Type and I want to say
if([Expense Type] = 'Breakfast' OR [Expense Type] = 'Lunch' OR [Expense Type] = 'Dinner' OR [Expense Type] = 'Meals Other' AND [Expense Account] = 'Billable' AND [Total Spend] <= 100,1,0) as FlagMeals.
This is not working but essentially I need each expense type and if its billable and less than 100 total spend then flag as 1...
whats is the correct syntax withing the script editor for something like this?
if(
(
(
[Expense Type] = 'Breakfast' OR [Expense Type] = 'Lunch' OR [Expense Type] = 'Dinner' OR [Expense Type] = 'Meals Other'
)
AND
(
[Expense Account] = 'Billable'
)
AND
(
[Total Spend] <= 100),1,0
)
)
as FlagMeals.
Something like this should work. Parentheses instruct which part to execute first.
you missed brackets but statement was fairly right.
one thing that i don't understand is below.
([Total Spend] <= 100)
isn't it supposed to be ([Total Spend] < 100) as you described less than 100 rather than less or equal to 100.
if(
(
[Expense Type] = 'Breakfast' OR [Expense Type] = 'Lunch' OR [Expense Type] = 'Dinner' OR [Expense Type] = 'Meals Other'
)
AND
([Expense Account] = 'Billable' )
AND
([Total Spend] < 100)
,1,0)
as FlagMeals
If you really need "each expense type and if its billable and less than 100":
if([Expense Account] = 'Billable' AND [Total Spend] < 100,1,0) as FlagMeals
if(Match([Expense Type] , 'Breakfast' , 'Lunch', 'Dinner' , 'Meals Other') AND [Expense Account] = 'Billable' AND [Total Spend] <= 100,1,0) as FlagMeals.
should perform better
Feeling Qlikngry?
Try this,
if(Wild Match([Expense Type] , 'Breakfast' , 'Lunch', 'Dinner' , 'Meals Other') AND [Expense Account] = 'Billable' AND [Total Spend] <= 100,1,0) As FlagMeals
Have got your desired result !!!!