Warm tip: This article is reproduced from stackoverflow.com, please click
dax grep powerbi string

Power BI

发布于 2020-04-07 10:21:58

I'll describe my question using an oversimplified, hypothetical example.

Let's say I have a text column with a bunch of random words in it. I want to make a new True/False column based on whether or not a word in that row contains the letter A. I can use the following DAX formula:

ContainsA = IF((SEARCH("A",Table[Words],,0))>=1,TRUE(),FALSE())

So, if you're here looking for a solution to this problem, this does work. My question is this:

Is there a better way to do this? Surely there must be some DAX function that returns True/False directly, right?

Questioner
yaxx0r
Viewed
82
Alexis Olson 2020-02-01 02:25

Try the CONTAINSSTRING function.

ContainsA = CONTAINSSTRING ( Table[Words], "A" )