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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
smacsween
Frequent Visitor

Clustering with categorical data

Hi

I am trying to use clusters using various different 3rd party visualisations.  They need me to have the data in numerical format but a lot of my data is categorical (country, department, etc).  

 

In  Python I would do a Transform or Encoding (eg OneHotEncode) to transform the categorical into numerical, but how do I do this in PowerBI?

 

Thanks

Scott

2 REPLIES 2
smacsween
Frequent Visitor

Thanks Pat, yes it's the ones from the marketplace.  I will give that a try with Python and with query editor, I appreciate your advice.

mahoneypat
Microsoft Employee
Microsoft Employee

Sounds like you have looked at the visuals in the marketplace, but fyi if not.  FYI that, if you do know Python, you can use the Python visual to create your own visual.  To do it in the query editor, it would be helpful to see example data and desired output; however, I would probably approach that by making a distinct list of the categories and then add a custom column where it find the position of that category in the list for each row.  You also could do a RANKX on that column on the DAX side to get a number based on alphabetical order.

 

mahoneypat_0-1606054555733.png

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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