MapSubString('Map_Abbrev', Address)

MapSubString in Power BI

MapSubString replaces every occurrence of each "from" string in a mapping table with its "to" string. Power Query has no single function for this, but List.Accumulate over the mapping rows with Text.Replace does the same. DAX would need one nested SUBSTITUTE per pair, so do it in Power Query.

Partial / different approach Power Query

Short answer: Load the mapping as a two-column table (From, To). Then use List.Accumulate(Table.ToRows(Map), [Address], (s, r) => Text.Replace(s, r{0}, r{1})).

What it does in Qlik

MapSubString('MapName', text) uses a MAPPING table of (from, to) pairs and replaces substrings within the text, unlike ApplyMap, which maps whole values. Replacements are case-sensitive and are applied from the start of the string.

Qlik example

Qlik script
Map_Abbrev: MAPPING LOAD * INLINE [
From, To
Str., Street
Ave., Avenue ];
LOAD MapSubString('Map_Abbrev', Address) AS Address FROM ...;

Power BI equivalent

Power Query

Power Query M
let
    Pairs = Table.ToRows(Map_Abbrev),       // {{"Str.","Street"}, {"Ave.","Avenue"}}
    Fixed = Table.TransformColumns(Customers, {{"Address", each
                List.Accumulate(Pairs, _, (s, r) => Text.Replace(s, r{0}, r{1})), type text}})
in
    Fixed

Gotchas and behaviour differences

  • List.Accumulate applies the pairs one after another, so an earlier replacement can create text a later pair then matches. Qlik processes the string in a single pass. Order the pairs from longest to shortest, and avoid "to" values that contain other "from" values.
  • Text.Replace is case-sensitive, like Qlik. For a case-insensitive version, normalise the case first.

Official documentation

Related pages

Spotted an error or a better pattern? QlikToDax is maintained by a working BI consultant; corrections are welcome via the About page. Last reviewed 2026-10-25.