AEP Data Prep - Creating a calculated field for marketing channel definitions | Community
Skip to main content
Level 2
May 7, 2026
Question

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

  • May 7, 2026
  • 3 replies
  • 91 views

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?

3 replies

Level 2
May 8, 2026

!--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-->

farzaanhAuthor
Level 2
May 11, 2026

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-->

Level 2
May 11, 2026
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?

Level 2
May 11, 2026

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.

DanaJoachim-Motoc
Level 1
May 11, 2026

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"))