Combined expression with two calculations

Dear all,

For a long time i am being struggling with combining two expressions which are already calculated in 1 calculated field: 1 expression should be applied on the dimension value A, the second on the dimension value B.

On the screenshot below you can see the high-level structure of my calculation:

  • Data type
  • Balance date

And two metrics:

  • C. position:

sum(min({opening_balance_amount}*{balance_rate}, [{account_name}, {balance_date}]))

  • Running total amount:
    runningSum( sum({transaction_amount}*{transaction_rate})
    ,
    [{balance_date} ASC],
    [{data_type}]
    )

The goal is to create one new expression which will calculate the c. position where data_type=‘actuals’, everything else - running total amount

The below one doesn’t work:

ifelse({data_type}=‘actuals’,

{cash_position}, {running total amount}

)

I would appreciate your help and input how to achieve this