How to Do Clustering in Power BI
Your data is hiding valuable stories in the form of natural groups and segments. Finding them manually is like looking for a needle in a haystack, but Power BI's built-in clustering feature can automatically uncover these patterns for you. This guide will walk you through exactly how to use clustering in Power BI to segment your data and find actionable insights, step-by-step.
What is Clustering and Why Should You Care?
At its core, clustering is a machine learning technique that groups similar data points together based on their characteristics. Think of it as an automated way of sorting your data into meaningful buckets. Instead of you deciding the criteria for grouping, the algorithm finds the most natural and logical groupings on its own.
Why is this so useful for marketing and sales? Imagine you run an e-commerce business. You could use clustering to analyze your customers based on:
- How much they've spent (Monetary Value)
- How often they've purchased (Frequency)
- How recently they've bought something (Recency)
The clustering algorithm might automatically identify groups like:
- High-Value Champions: Customers who buy frequently, spend a lot, and have purchased recently.
- At-Risk Customers: Previously good customers who haven't made a purchase in a long time.
- New & Promising: Customers who just made their first purchase and have high potential.
Once you've identified these segments, you can tailor your marketing strategies. You can send an exclusive offer to your "Champions," a re-engagement campaign to your "At-Risk" group, and a welcome series to your "New & Promising" customers. That's the power of clustering: it turns raw data into clear, actionable business strategies.
A Step-By-Step Guide to Automatic Clustering in Power BI
Power BI makes creating clusters incredibly straightforward, especially with scatter plots. There's no need to write complex code, you can find powerful insights with just a few clicks. For this example, let's use a sample dataset of customers with their total sales and the number of orders they've placed.
1. Prepare Your Data and Choose a Visual
Clustering works best with numerical data. Make sure the fields you want to analyze (like sales, quantity, sessions, etc.) are set to a numerical data type in Power BI Desktop.
The easiest visual to use for clustering is the scatter plot, since it helps you see the physical distribution of your data points. Start by selecting the scatter plot visual from the Visualizations pane.
2. Add Your Variables to the Scatter Plot
Now, you need to tell the scatter plot what data to show. For our customer segmentation example:
- Drag the metric you want on the x-axis into the X Axis field. Let’s use "Total Orders."
- Drag the metric for the y-axis into the Y Axis field. We'll use "Total Sales."
- Drag the value that identifies each individual data point (like "CustomerID" or "Customer Name") into the Values field. This is important — it tells Power BI to plot a separate dot for each customer instead of just one aggregated point.
At this point, you'll have a scatter plot showing all your customers. You might already be able to spot some natural groupings with your eyes, but let's have Power BI do the heavy lifting.
3. Use the "Automatically Find Clusters" Feature
This is where the magic happens.
- Click on the three dots (More options) in the top-right corner of your scatter plot visual.
- From the dropdown menu, select Automatically find clusters.
A dialog box will pop up. For now, you can leave the "Number of clusters" field blank and let Power BI decide the optimal number of groups. We'll revisit this later. Give your cluster a name, like "Customer Segments," and click OK.
4. Review and Use Your New Clusters
Power BI will now analyze your data and assign each customer to a cluster. Two things will happen:
- Your scatter plot points will instantly change color, with each color representing a different cluster.
- A new field will appear in your Data pane. In our example, it will be named "Customer Segments (cluster)." This new field is now a part of your data model and can be used in any other visual, just like your original data columns!
This new "(cluster)" field is where the real value lies. You can drag it into other charts and tables to analyze the characteristics of each segment found.
Interpreting and Analyzing Your Clusters
Finding the clusters is just the first step. The real goal is to understand what they represent so you can take action.
Rename Your Clusters for Clarity
"Cluster 1" and "Cluster 2" aren't very descriptive. By analyzing your visuals, you can give them meaningful names. In our scatter plot example, you might see:
- A cluster in the top-right (high sales, high orders) could be your "VIP Customers".
- A group in the bottom-left (low sales, low orders) could be your "Casual Shoppers".
- A cluster with high orders but lower sales could be "Bargain Hunters."
To rename them, right-click on your new cluster field in the Data pane and select Rename. While you can't rename the individual clusters within Power BI's menu, a common best practice is to analyze their characteristics and then create a new calculated column with a SWITCH or IF statement to assign these custom, business-friendly names.
Use Your Clusters Across Your Report
Your new cluster field is dynamic. You can now use it to slice and dice all the other data in your report.
- Create a characteristics summary table: Build a table visual showing each customer segment and their average sales, average orders, and total unique customers. This gives you a quick-look performance summary for each group.
- Cross-filtering in action: On your report, add another visual, like a bar chart showing sales by product category. Now, when you click on just the "VIP Customers" cluster in your scatter plot, the bar chart will automatically filter to show you only the product categories that this specific group buys. This can reveal powerful insights, like discovering that your best customers overwhelmingly prefer one or two specific product lines.
Customizing and Refining Your Clusters
Sometimes, letting Power BI automatically decide the number of clusters isn't ideal for your business needs. You might want to create a specific number of segments for a campaign, or perhaps experiment to find a more useful grouping.
Modifying the Number of Clusters
You can easily edit your clusters. In the Data pane, find the field Power BI created, click the three dots, and select Edit clusters. In the dialog box, you can now enter a specific number in the Number of clusters field. Try starting with 3, 4, or 5 and see how the groups change. The goal is to find a number that creates distinct, understandable, and actionable segments. If you create too many clusters (say, 10 or more), the distinction between them may become blurry and less useful. If you create too few (like just 2), you may miss out on important nuance in the data. Experiment to find the balance that best tells a story.
Clustering on Different or Additional Variables
The built-in scatter plot clustering is easy, but it's typically limited to the two variables you've plotted. What if you want to cluster based on three or more variables, like sales, orders, and profit margin? Other visuals and some Power BI extensions using Python or R scripts let you include more variables in your clustering algorithm, which can sometimes produce more interesting segments.
While that can quickly get very technical, just know that for marketing, sales, and product analysts, simply running clustering on various pairs of key metrics (e.g., sessions vs. conversion rate, average order value vs. lifetime value, time on site vs. number of pages viewed) can provide more than enough insight to kickstart your next successful campaign.
Final Thoughts
Learning how to perform cluster analysis in Power BI transforms your reports from static displays of data into dynamic tools for discovery. You can quickly go from a sea of undifferentiated data points to clearly defined customer segments, which helps your team make smarter, more targeted decisions. And as we just went over, with Power BI’s built-in features, you don’t even need a data science background to get started!
While tools like Power BI are fantastic for digging into the details, sometimes you just need to get to the answer even faster, without wrangling visuals or navigating menus. For that, we built Graphed. Since we securely connect directly to your underlying tools (like Shopify, Google Analytics, or Salesforce), we make data analysis a simple, conversational experience. Instead of setting up your clustering variables manually, in seconds you're able to simply ask something like, "Segment my customers based on their spending and purchase frequency," and immediately get an automated breakdown. We aim to help marketers and sales teams skip straight to the actionable insights without needing to become a part-time BI expert.
Related Articles
How to Enable Data Analysis in Excel
Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.