'Couldn't save calculated field' error with ifelse function

Hi,
I couldn’t find out the cause of the error. I tried to simplify this calculated field but it didn’t work. Thanks a lot ~

Hi @thecuon119

Could you please share the expression instead of screenshot for us to check further and along with business usecase to rewrite the expression, wondering why the lines 3 & 4 are having exact same expression similarly line 7 & 8 .

Thanks
VInod

Here it is:

  1. My main calculated field
    ifelse(${RevenueType} = ‘Estimated’,
    ifelse({Business line} = ‘Finance’,
    coalesce(sumIf({sum_occ_total_commissions} * {ti le duyet camp}, {transactions_sales_time} >= ${Datefrom} and {transactions_sales_time} <= ${Dateto}), 0),
    coalesce(sumIf({sum_occ_total_commissions} * {ti le duyet camp}, {transactions_sales_time} >= ${Datefrom} and {transactions_sales_time} <= ${Dateto}), 0)
    ),
    ifelse({Business line} = ‘Finance’,
    coalesce(sumIf({sum_app_total_commissions}, {transactions_sales_time} >= ${Datefrom} and {transactions_sales_time} <= ${Dateto}), 0) - 18000000 * (max({datediff datefrom dateto DD}) + 1),
    coalesce(sumIf({sum_app_total_commissions}, {transactions_sales_time} >= ${Datefrom} and {transactions_sales_time} <= ${Dateto}), 0)
    )
    )
  2. {Business line}
    ifelse(

{business_line} = ‘4’, ‘Mobile’,

{business_line} = ‘5’, ‘Finance’,

{business_line} = ‘7’, ‘Ecommerce’,

{business_line} = ‘d2c’, ‘D2C’,

{business_line} = ‘d2c trading’, ‘D2C’,

‘Other’)
3. {ti le duyet camp }
ifelse({Business line}= ‘Finance’, 0.6, {Business line} = ‘Mobile’, 0.79,
{Business line}= ‘Ecommerce’,0.5,1)
4. ${RevenueType} = ‘Estimated’ or ${RevenueType} = ‘Approved’
When {Business line} <> ‘Finance’ , I want the occurred total commission + approved total commission to stay the same while {Business line} = ‘Finance’, the occurred one stays steady and the approved one - 18M per day

Hope it helps you !

Hi @thecuon119

Could you please try with below expression . Please validate the business logic before using it.

ifelse( (${RevenueType} = ‘Estimated’ OR ${RevenueType} = ‘Approved’)
AND ({Business line} <> ‘Finance’),
coalesce(sumIf({sum_occ_total_commissions} * {ti le duyet camp}, {transactions_sales_time} >= ${Datefrom} and {transactions_sales_time} <= ${Dateto}), 0),
(${RevenueType} = ‘Estimated’ OR ${RevenueType} = ‘Approved’)
AND ({Business line} = ‘Finance’),
coalesce(sumIf({sum_app_total_commissions}, {transactions_sales_time} >= ${Datefrom} and {transactions_sales_time} <= ${Dateto}), 0) - 18000000 * (max({datediff datefrom dateto DD}) + 1),
0
)

Thanks
Vinod

It’s still the same. So weird !

Even i deleted the part datediff…

Hi @thecuon119

Did you delete and recreated any of the parameters or calculated fields with the same name ? suspecting one of the fields used in this expression is having invalid reference to deleted object id. Could you please try checking all the fields & calculated fields and check all are having proper expression and try replacing field by field with empty string ‘’ and check where its breaking .

Please create a support ticket for dev team to dig deeper into why calculated fields are not getting saved.

Here are the steps for opening a support ticket - Creating support cases and case management - AWS Support . If your company has someone who manages your AWS account, you might not have direct access to AWS Support and will need to raise an internal ticket to your IT team or whomever manages your AWS account. They should be able to open an AWS Support case on your behalf

Thanks
VInod