How to Make Age Groups in Power BI
When you have a column of customer ages, it’s tough to spot trends by looking at individual numbers like 27, 43, and 61. Grouping those ages into useful brackets like “25-34” or “45-54” instantly makes your data easier to analyze and visualize. This article will walk you through the three best ways to create age groups in Power BI, from the fastest method for simple bins to more flexible options for custom ranges.
Why Group Ages in Your Power BI Reports?
Working with exact ages can be messy. If you create a bar chart showing sales for every single age from 18 to 80, you end up with a crowded, unreadable mess. Segmenting or 'binning' your data into logical groups solves this problem and gives you clearer insights. For example, you can quickly answer questions like:
- Which age demographic purchases our most expensive products?
- How does marketing campaign performance differ between customers in their 20s versus those in their 50s?
- Are younger or older users spending more time on our website?
Grouping turns a long list of individual data points into a powerful tool for understanding your audience. Let's look at how to get it done.
Method 1: The 'New Group' Feature (The Quickest Method)
Power BI has a built-in feature for creating simple, evenly sized groups. This is the fastest way to get started and works perfectly when you want to create standard, equal-sized bins like 10-year age increments (e.g., 20-29, 30-39, 40-49).
Here’s how to use it step-by-step:
- In the Fields pane on the right side of Power BI Desktop, find your table and locate the column that contains the age data (we'll call it 'Age' for this example).
- Right-click on the 'Age' field and select New group.
- A dialog box will pop up. This is where you configure your groups.
Configuring Your Groups
In the 'Groups' window, you have a few options to set:
- Name: Give your new field a clear name, like "Age Bins" or "Age Group."
- Group type: Make sure this is set to Bin.
- Bin size: This is the most common option. If you want 10-year age increments, enter 10. Power BI will automatically create groups like 0-9, 10-19, 20-29, and so on, covering the full range of ages in your data.
- Number of bins: Alternatively, you can specify how many total groups you want. If you set this to 5, Power BI will take the full age range (e.g., 18 to 78) and divide it into five equal groups.
Once you’ve set your bin size, click OK. You'll see a new field appear in your Fields pane called "Age Group (bins)." You can now drag this new field into any visual.
Pros: This method is incredibly fast and requires no code at all.
Cons: It’s not ideal for creating custom, uneven ranges (like "18-24", "25-35", "36-50"). For that, you’ll want to use one of the next two methods.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Method 2: Conditional Columns in Power Query (For Better Control)
If you need specific, custom groups - which is very common for demographic analysis - the best place to create them is in the Power Query Editor. Using a 'Conditional Column', you can define the exact start and end for each of your age buckets.
Power Query is Power BI's data transformation engine that works in the background. Making changes here modifies the data before it's loaded into your report for analysis.
Here’s how to do it:
1. Open the Power Query Editor
From the 'Home' tab in Power BI Desktop, click on Transform data. This will open the Power Query Editor in a new window, where you'll see all of your data tables.
2. Add a Conditional Column
Select the table that contains your age data. Now, follow these steps:
- Click on the Add Column tab in the ribbon at the top.
- Select Conditional Column.
3. Define Your Age Group Logic
The ‘Add Conditional Column’ window is where you build your logic with simple If/Then statements. The order of these rules is important, so start with the youngest age group first and work your way up.
Let’s create some typical marketing age brackets:
- Set your New column name to something descriptive, like "Custom Age Group."
- For the first rule, set the following:
- Click Add clause to add the next rule:
- Continue adding clauses for each of your desired groups:
Finally, use the Else field at the bottom to catch everyone else. Enter "65+" here.
When you're finished, the window should look like a complete set of rules. Click OK. A new "Custom Age Group" column will appear in your table.
4. Close and Apply
On the 'Home' tab of the Power Query Editor, click Close & Apply. Your changes will be loaded into the Power BI data model, and you can now use your perfectly crafted age groups in your report.
Pros: Gives you full control over custom group ranges without writing any code. It’s also very easy to edit later by just returning to the applied step in Power Query.
Cons: A little more manual effort upfront compared to the 'New Group' feature.
Method 3: Writing a DAX Calculated Column (For Maximum Flexibility)
If you're comfortable with formulas, you can also create age groups directly in the data model using DAX (Data Analysis Expressions). This approach creates a new column whose values are calculated on the fly based on your formula.
The most elegant way to do this in DAX is with the SWITCH function, which is cleaner than writing a bunch of nested IF statements.
Here’s the process:
- In Power BI Desktop, click on the Data view icon on the far left (it looks like a table).
- Select the table that contains your age data.
- From the Table tools ribbon that appears at the top, click New column.
- A formula bar will open. This is where you’ll enter your DAX expression.
Copy and paste the following formula into the formula bar. Be sure to replace Customers[Age] with your actual table and column name.
Age Group (DAX) = SWITCH( TRUE(), Customers[Age] <= 17, "Under 18", Customers[Age] <= 24, "18-24", Customers[Age] <= 34, "25-34", Customers[Age] <= 44, "35-44", Customers[Age] <= 54, "45-54", Customers[Age] <= 64, "55-64", "65+" )
Press Enter to create the column. Just like that, a new calculated column will be added to your table with the specified age groups.
The SWITCH(TRUE(), ...) function checks each logical condition in order until one returns TRUE, and then it provides the corresponding result. For a 21-year-old, it would fail the first check (21 <= 17 is false) but pass the second check (21 <= 24 is true), so it would assign the value "18-24".
Pros: Very powerful and allows for complex logic beyond simple groupings.
Cons: Requires learning a bit of DAX. Calculated columns also use more memory and can slightly increase the file size of your report, so for simple groupings, Power Query is often the more efficient choice.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Putting It All Together: Visualizing and Sorting Your Age Groups
Once you’ve created your new age group column using any of the three methods, you can use it in your visualizations. However, there's one common stumbling block: sorting.
By default, Power BI will sort your age groups alphabetically ("18-24", "25-34", "35-44", "Under 18"), which isn’t correct. Here's how to fix it.
1. Create a Sort Order Column
You need to create another column that tells Power BI the correct order. You can do this in Power Query (with another Conditional Column) or with DAX. Assign a number to each group representing its order.
For example, in Power Query's Conditional Column feature:
- Create a new column named "Age Group Sort Order."
- Enter the rules:
- Set the 'Data type' of this new column to Whole Number.
- Click Close & Apply.
2. Apply the Sort by Column Feature
Now, back in the main Power BI report view:
- Go to the Data view.
- Select your age group text column (e.g., "Custom Age Group").
- Go to the Column tools tab in the ribbon.
- Click Sort by column and choose your new sort order column ("Age Group Sort Order").
Power BI will now use your numerical column to sort the text column in every visual. Your bar charts and tables will finally appear in the logical chronological order you intended.
Final Thoughts
Segmenting customers by age is a fundamental step in building insightful sales and marketing reports. This post covered three effective ways to do it in Power BI, enabling you to move from raw data to clean, actionable categories, whether you need quick, even bins or completely custom demographic groups.
While mastering tools like Power BI is incredibly rewarding, we know that the work doesn't stop after you've cleaned the data. If your goal is to get straight to answers about marketing performance without getting bogged down in data prep, Graphed may be for you. We built our tool to bypass these manual steps by allowing you to simply connect your data sources - like Google Analytics, Shopify, or Facebook Ads - and use plain English to ask what you want to see. Instead of creating bins and sort orders, you can just ask, "Show me last month's revenue by age group," and get a live, automated dashboard in seconds.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.