Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am trying to find the number of times particular texts appear in a description. For example if the description is " faulty item LAV-L3,LAV-L3F,LAV-L3R found". I want to count how many times "LAV-L3" was found in the text, but since LAV-L3R AND LAV-L3F also has LAV-L3 as part of the text,that is also being counted. I only want it to return count of 1. How to do it in Power Bi as DAX.
Hello @mithunishad,
Can you please try this approach:
ExactMatchCount =
VAR SearchText = "LAV-L3"
VAR SearchTextLength = LEN(SearchText)
VAR Description = [YourDescriptionColumn]
VAR DescriptionLength = LEN(Description)
VAR CleanedDescription = SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Description, ",", " "), ".", " "), "-", " ")
VAR TextParts = TRIM(CLEAN(CleanedDescription))
VAR WordCount =
COUNTROWS(
FILTER(
GENERATESERIES(1, DescriptionLength - SearchTextLength + 1, 1),
MID(CleanedDescription & " ", [Value], SearchTextLength) = SearchText
&& MID(CleanedDescription & " ", [Value] + SearchTextLength, 1) IN {" ", "", ","}
)
)
RETURN
WordCount
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |