The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I'm using R package "cluster" in Power BI to cluster customers from their historical transactions.
My data looks like this:
Using Run R-Script command in Power Query Editor, I have the following code:
library(cluster)
k.means.fit_log <- kmeans(dataset[2:4], 3)
output<-dataset output$cluster <- k.means.fit_log$cluster
After this code is executed, I get an additional column with the number of the cluster and all looks good.
However, k.means.fit_log is a list with 9 rows, that contains the cluster centers, size, etc. so I'd like to be able to create another table or tables in Power BI with the contents of that object.
How can I achieve this?
Thanks in advance for your help!
Solved! Go to Solution.
Just add the code above and use the latest version of Power BI Desktop.
You may take a look at this post.
@v-chuncz-msft sure I know only R dataframes can be used in Power BI.
I could add the following to my R code above:
x<- as.data.frame(k.means.fit_log$centers)
This returns a 3*3 dataframe.
The question is how to export this dataframe to a another table using Power Query?
Just add the code above and use the latest version of Power BI Desktop.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
76 | |
65 | |
52 | |
51 |
User | Count |
---|---|
128 | |
117 | |
78 | |
65 | |
63 |