KeepChar(Phone, '0123456789')
KeepChar and PurgeChar in Power BI
In Power Query, Text.Select keeps only the listed characters (KeepChar) and Text.Remove drops them (PurgeChar). Both accept ranges such as {"0".."9"}. DAX has no equivalent. You would need one nested SUBSTITUTE per character, so clean the text in Power Query.
Short answer: Use Text.Select([Phone], {"0".."9"}) for KeepChar and Text.Remove([Name], {"-", ".", " "}) for PurgeChar.
What it does in Qlik
KeepChar(text, chars)returns the text with only the characters listed in chars.PurgeChar(text, chars)returns the text with those characters removed.- Matching is character by character and case-sensitive.
Qlik example
KeepChar(Phone, '0123456789') AS PhoneDigits,
PurgeChar(SKU, ' -./') AS SKUCleanPower BI equivalent
Power Query
= Table.AddColumn(Src, "PhoneDigits", each Text.Select([Phone], {"0".."9"}), type text)
= Table.AddColumn(Src, "SKUClean", each Text.Remove([SKU], {" ", "-", ".", "/"}), type text)
// letters and digits only
= Text.Select([Code], {"A".."Z", "a".."z", "0".."9"})Gotchas and behaviour differences
- No DAX equivalent.
SUBSTITUTEreplaces one string at a time, so stripping 10 characters takes 10 nested calls. Do it in Power Query, or upstream in SQL. - Ranges follow Unicode order, so
{"A".."Z"}excludes accented letters such as É. Add them explicitly if your data has them.
Official documentation
- KeepChar - script and chart function (Qlik Help)
- PurgeChar - script and chart function (Qlik Help)
- Text.Select (Power Query M) (Microsoft Learn)
- Text.Remove (Power Query M) (Microsoft Learn)
Related pages
Trim(Replace(Name, ' ', ' '))
Replace and Trim
Qlik Replace maps to DAX SUBSTITUTE, not DAX REPLACE, which is positional. Trim has a subtle difference. Qlik Trim and Power Query Text.Trim only remove leading and trailing spaces. DAX TRIM also collapses repeated spaces inside the text to one, so the results can differ.
Partial / different approach
SubField(FullName, ' ', 1)
SubField
SubField has two modes. With an index (SubField(s, ',', 2)) it returns one part of the string. Without an index, in a LOAD, it creates one row per part. In Power Query, use Text.Split for the first and "Split column by delimiter into rows" for the second. DAX has no split function, but PATHITEM with SUBSTITUTE returns the nth part.
Partial / different approach
ApplyMap('MapName', expr [, default])
Mapping Load and ApplyMap
ApplyMap looks up a value in a two-column mapping table during load. In Power BI, use a merge in Power Query, a record lookup, or simply a relationship with RELATED. The behaviour differs for case sensitivity, duplicates and missing keys.
Partial / different approach
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.