WrittenInCode
WrittenInCode

Reputation: 51

Filter string by non alphanumeric character

There is a field where the value is a colon delimited string with key:value pairs.

It has been filtered by a key such that the string, in DAX, becomes:

:value;restofstring

Trying to filter on the colon, :, or the semicolon, ;, throws an error.

What is the proper way to extract just the value?

Upvotes: 0

Views: 233

Answers (1)

Ian Felton
Ian Felton

Reputation: 91

You can use PATHITEM to get at values in delimited fields.

For example, PATHITEM( SUBSTITUTE( "key:value", ":", "|"), 1) will return "key".

Changing it to PATHITEM( SUBSTITUTE( "key:value", ":", "|"), 2) will return "value".

The core pattern is PATHITEM( SUBSTITUTE( yourdelimitedfield, yourdelimiterwithqutoes, "|"), yourposition).

Upvotes: 1

Related Questions