Solved

Error: Function error: function IF argument 2 and 3 need to have the same type

  • 24 January 2024
  • 4 replies
  • 128 views

  • Newly Minted Pigmenteer
  • 2 replies

Hi!

I’m having issues with a formula. My formula is currently looking like this:

The result I get is the error message Function error: function IF argument 2 and 3 need to have the same type. Any idea of what I need to do to get the dummy name in the CC# column?

icon

Best answer by Issam Moalla 24 January 2024, 10:54

View original

4 replies

Userlevel 5
Badge +9

Hi @Petter ,

The error here is due to a data type mismatch: You need to have the 2nd argument and 3rd argument result into the same data type as your target property here CC #.

  • 2nd Argument:
    ‘Cost Center GL’.’CC Concatenated’ = ‘9999 Dummy CC”
    will result in a boolean output (True/False).
  • 3rd Argument:
    ‘GL test’.’CC (Load)’

    will result in attributing the same data type as the property CC (Load) which in your case is the Cost Center dimension.

Since your target property has a Cost Center dimension data type as well you would need to adjust the 2nd argument.
To achieve the logic you are looking to apply the 2nd argument could reference the item directly within the Cost Center dimension directly:

'Cost Center GL'.'CC Concatenated'."99999 Dummy CC"

This would result in the Cost Center dimension data type.


hope this helps,
Issam
 

I love easy fixes👌

Thanks, Issam!

Hi @Issam Moalla!

Having an issue with this again. Trying to set a new column with Revenue category ID and Spend category ID. Most lines either has a value in those columns, but I’m not able to conjoin them into a new column. Can you tell what the error could be in this instance?

 

Userlevel 5
Badge +9

Hi @Petter ,

Here you have same error: your property accepts one type of result and in your formula you are mixing two different dimensions.
In the IF statement if the condition is true you would generate a Revenue Category ID , If it is false the result would
be Spend Category ID However your Target Property would have one specific data type either Revenue Category ID or Spend Category ID it can’t be both.
If you want to achieve this logic, you need to apply the following:

  1. Merge the two dimensions together: Create one Category dimension containing all Revenue and Spend with: a property Revenue category? to tag the Revenue items and a property Spend category? to tag the spend items. 
  2. Update the Revenue Category and Spend Category properties in your transaction list to have a data type the new Category dimension.
  3. Reimport the Transaction list to repopulate the items
  4. Apply the same formula to get the final Category.

Hope this is helps,
Issam

Reply