cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tejapowerbi123
Helper IV
Helper IV

Unstructured Data repetitive Word Count

Hello Community,

Please review below and provide your guidance.

My data table has unstructured  data and also Look up table.

Requirements:If lookup table words matches with Data Table then if should count words in a new table or in Data Table.

I am not able to figure it out how to procedd?

Once i have word count it is going to use on bar chart (Example:Bar for Financail Analysis=3,Food Analysis=2)

I have posted the question here and I got the answer but when same words repeat it will not count correctly.

https://community.powerbi.com/t5/Desktop/Unstructured-Data-Word-Count/m-p/1202169#M537384

Data Table

Comments

Financial Analysis,Financial Analysis & Health Analysis is very Important.

Food Analysis & Financial Analysis is very Important & Food Analysis is also important

 

Lookup Table

Financial Analysis

Health Analysis

Food Analysis



Result Table

Column_1

Word_Count

Financail Analysis

3

Health Analysis

1

Food Analysis

2

 

1 ACCEPTED SOLUTION

@tejapowerbi123 

the output exactly the same as you mentioned in the first post. if you need case insensitive statement use

Measure = 

var _lookupValue  = LOWER(MAX('Lookup Table'[Text Search]))

RETURN
CALCULATE(SUMX('Data Table', (LEN('Data Table'[Comments]) - LEN(SUBSTITUTE(LOWER('Data Table'[Comments]), _lookupValue, "")))/LEN(_lookupValue)))

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

6 REPLIES 6
az38
Super User II
Super User II

Hi @tejapowerbi123 

try

Measure = 
var _lookupValue = MAX('Lookup Table'[Lookup Column])
RETURN
CALCULATE(SUMX('Data Table', (LEN('Data Table'[Comments]) - LEN(SUBSTITUTE('Data Table'[Comments], _lookupValue, "")))/LEN(_lookupValue)))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi,

I have used below Measures and not able to get expected result.

Measure =

var _lookupValue = MAX('Lookup Table'[Text Search])

RETURN

CALCULATE(SUMX('Data Table', (LEN('Data Table'[Comments]) - LEN(SUBSTITUTE('Data Table'[Comments], _lookupValue, "")))/LEN(_lookupValue))


Comments

Financial Analysis & Health Analysis is very Important or financial analysis & Financial Analysis & Food Analysis

Food Analysis & Financial Analysis is very Importantcommunity_1.jpg

@tejapowerbi123 

the output exactly the same as you mentioned in the first post. if you need case insensitive statement use

Measure = 

var _lookupValue  = LOWER(MAX('Lookup Table'[Text Search]))

RETURN
CALCULATE(SUMX('Data Table', (LEN('Data Table'[Comments]) - LEN(SUBSTITUTE(LOWER('Data Table'[Comments]), _lookupValue, "")))/LEN(_lookupValue)))

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

Ashish_Mathur
Super User III
Super User III

Hi,

If data is unstructured, then is it fair to assume that there would be spelling mistakes as well or extra spaces/fewer spaces?  An example being Financial Analysis and FinancialAnalysis


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User IV
Super User IV

@tejapowerbi123 , refer this can help

https://radacad.com/find-a-text-term-in-a-field-in-power-bi-using-dax-functions



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

AllisonKennedy
Super User III
Super User III

You could try using a technique similar to this one to repeat the SEARCH() function until the result is Blank, then grab the number _n and add them all up.
https://community.powerbi.com/t5/Community-Blog/For-and-While-Loops-in-DAX/ba-p/636314

Check out my Tokyo 2020 report with live stats - KUDOS much appreciated



Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 


If you found this post helpful, please give Kudos. ?


I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 


www.excelwithallison.com

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors