Skip to main content
Level 2
May 7, 2026 1:32 PM UTC
Question

AEP Data Prep - Creating a calculated field for marketing channel definitions

Hi all, I’m currently trying to use the calculated field function in Data Prep to write logic for marketing channels, based on different URL parameters. However, I’m struggling with the syntax the interface is expecting, it seems to be semi SQL based but Adobe’s documentation is unclear around what the expected syntax should be.

I’m trying to use the iif function to build out the logic, such as:

iif(web.webPageDetails.URL LIKE ‘%di-social%’, "Social ",

iif…

Has anyone else used calculated fields for a similar purpose? Or are familiar with what syntax is expected for using nested iif statements?

5 replies

Level 2
May 8, 2026 5:12 PM UTC

!--scriptorstartfragment-->

I did use calculated fields, but not for marketing channels, I used for list..   In your case may be you can try this.. 

iif(web.webPageDetails.URL LIKE '%di-social%', 'Social',

    iif(web.webPageDetails.URL LIKE '%di-email%', 'Email',

        iif(web.webPageDetails.URL LIKE '%di-paid%', 'Paid',

            'Other'

        )

    )

)
iif(
size_of(xdm._experience.analytics.customDimensions.lists.list1.list) > 0,
join(xdm._experience.analytics.customDimensions.lists.list1.list, ","),
iif(
size_of(xdm._experience.analytics.customDimensions.lists.list2.list) > 0,
join(xdm._experience.analytics.customDimensions.lists.list2.list, ","),
iif(
size_of(xdm._experience.analytics.customDimensions.lists.list3.list) > 0,
join(xdm._experience.analytics.customDimensions.lists.list3.list, ","),
nullify
)
)
)

!--scriptorendfragment-->

Translate
farzaanhAuthor
Level 2
May 11, 2026 1:19 AM UTC

Thanks for the comment, I’ve tried the above but no luck. I’m now using matches_regex, but same result. Do you have any experience working with matches_regex under calculated fields?!--scriptorendfragment-->!--scriptorstartfragment-->

Translate
Level 2
May 11, 2026 4:52 PM UTC
iif(matches_regex(lower(web.webPageDetails.URL), '.*di-social.*'), 'Social',
iif(matches_regex(lower(web.webPageDetails.URL), '.*di-email.*'), 'Email',
iif(matches_regex(lower(web.webPageDetails.URL), '.*di-paid.*'), 'Paid',
'Other'
)
)
)

Can you try and see if this works?

Translate
Level 2
May 11, 2026 1:07 PM UTC

Hey ​@farzaanh, I experiemented with matches_regex before, my PQL looked something like this;

iif(
  matches_regex(lower(_<tenant_id>.offer1), ".*vip.*"),
  "Premium",
  iif(
    matches_regex(lower(_<tenant_id>.offer2), ".*gold.*"),
    "GOLD",
    iif(
      matches_regex(lower(_<tenant_id>.offer2), ".*diamond.*"),
      "Diamond",
      "Basic"
    )
  )
)

Hope this helps.

Translate
DanaJoachim-Motoc
Level 1
May 11, 2026 2:04 PM UTC

Hi ​@farzaanh - did you try using .* instead of % for your regex? It would be something like this: iif(matches_regex(web.webPageDetails.URL, ".*di-social.*"), "Social", iif(matches_regex(web.webPageDetails.URL, ".*di-email.*"), "Email", "Other"))

Translate