# Adding day condition in iflese statement

Hi,
I want to create a calculated field where if the order_day is in between 1st day to 10th day of a month then multiply 1.5 * sales,
if the order_day is between 11-23 then multiply 2* sales ,
else 4*sales.

i have already written a calculated field below i want to include the above logic too in the same formula can someone help me with this ?

ifelse(month - {latest month numbner} = 0 AND {order_day} AND year =2023, {sales}, 0))

i want to multiply a constant value to a column if date is between 17-18 of any month in quicksight

If order_day gives you the 1 - 31 value, then you can just nest the ifelse. The example below takes sales2 if order day between 1-10, takes sales4 if order day between 11 and 18, all other days sales*8.

ifelse(month - {latest month numbner} = 0 AND {order_day}>=1 AND {order_day}<=10 AND year =2023, {sales}*2,
month - {latest month numbner} = 0 AND {order_day}>=11 AND {order_day}<=18 AND year =2023, {sales}*4,
{sales}*8)

1 Like

it is giving me the below error.

Expression ifelse({order_day} < 5 ,{gms},0) for function < has incorrect argument type Date < Number. Function syntax expects ‘<COMPARABLE_TYPE> < <COMPARABLE_TYPE>’.