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
maganstephens
New Member

word frequency

I have a bunch of text that I'm interested in seeing if there is a trend in the words used. Word Cloud is great but I can't figure out how to count the words and the frequency of each word after Word Cloud removes the stop words. Is there a way to do this?

Thanks,
Magan

3 REPLIES 3
Phil_Seamark
Employee
Employee

Hi @maganstephens,

 

I think this is even better.  Use the following R-Script in the Query Editor to add a column that will have the count of words in another column that contains the wordcount from another column

 

I used a basic table and the column that this counts is called Words

 

RScript.png

 

# 'dataset' holds the input data for this script
dataset = within(dataset , {WordCount= sapply(gregexpr("\\b\\W+\\b", Words, perl=TRUE), function(x) sum(x>0) ) + 1 })
output <- dataset

wc.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Phil_Seamark
Employee
Employee

Hi @maganstephens,

 

You can use R to count words

 

I did a google for some scripts to count words using R and had success with a simple example.

 

This example uses a table with 1 row called Column1 and plotted the correct number of words to the screen.

 

str1 <- dataset$Column1
str2 <- gsub(' {2,}',' ',str1)
plot(length(strsplit(str2,' ')[[1]]))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Greg_Deckler
Super User
Super User

You can try the technique I used here:

 

https://social.technet.microsoft.com/wiki/contents/articles/31461.power-bi-text-analytics-and-the-un...

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.