Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

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
Community Champion
Community Champion

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
Ashish_Mathur
Super User
Super User

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
Super User
AllisonKennedy
Super User
Super User

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

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as 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 C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.