Forum Discussion

RajivRavichand's avatar
RajivRavichand
Frequent Visitor
3 years ago
Solved

Error Extraxt after delimiter if contains _ or return same value

Hi Im facing issue when using the Extraxt after delimiter, I used below expression but facing issue. Can you please check is there any issue in below DAX.   = Table.AddColumn(#"Duplicated Column", ...
  • ImkeF's avatar
    3 years ago

    Hi RajivRavichand ,
    the reason for this error message lies in the underscore. This represents a record in that environment.
    Did you mean to put a reference to a column there instead (like you did in "Region/Division"):

    = Table.AddColumn(#"Duplicated Column", "Region", each if Text.Contains(_, "-") then Text.AfterDelimiter([#"Region/Division"], "_") else _, type text)

    replace by:

    = Table.AddColumn(#"Duplicated Column", "Region", each if Text.Contains([YourColumnName], "-") then Text.AfterDelimiter([#"Region/Division"], "_") else _, type text)