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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
SriKandimalla
Helper I
Helper I

Count how many occurances of a string in a column in reference with a different column of strings

I have a column with folder paths, The root folders are sub divided and the divided folders are again subdivided and so on. i have some long strings in the column.

Now, I have to get the count of how many times a particular path has occurred in the whole column.  

 

Example: I have the data exactly like this with couple hundered thousands of rows. The main path "c:\SHARE\Sample" must be counted couple hundered thousand times as it will be occurred in all of the other paths.

Folder 1 will be counted little less than the main path and so on for the folder 2,.. etc. 

Capture.PNG

 

Any ideas are greatly appreciated. I can add the coulmn in power query or DAX. So both are an option for my case.

 

Thank you in advance

1 REPLY 1
Nathaniel_C
Super User
Super User

Hi @SriKandimalla ,

Try this, create column using the code below.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel




Column = 
var _string = Counter[Column1]

var _countS = CALCULATE(COUNTROWS(Counter),FILTER(Counter,CONTAINSSTRING(Counter[Column1],_string)))

return _countS

strin.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.