Forum Discussion

pbiforum123's avatar
pbiforum123
Post Patron
3 years ago
Solved

Help needed in creating calculated column and create the values based on the tag using CONTAINSTRING

Fowmy  I need help in creating the calculated column using CONTAINSTRING or anyother string function. Let say there is column called "Page Name" in that I need to find the below patterns and tag it...
  • tamerj1's avatar
    tamerj1
    3 years ago

    pbiforum123 

    Use

    new column =
    SWITCH (
        TRUE (),
        CONTAINSSTRING ( TableName[ColumnName], "US:*:shop-all:" ), "PLP",
        CONTAINSSTRING ( TableName[ColumnName], "US:*:products:" ), "PDP",
        CONTAINSSTRING ( TableName[ColumnName], "US:search :" ), "SRP",
        CONTAINSSTRING ( TableName[ColumnName], "US:" ), "Homepage",
        "Others"
    )