How to Create Age Bins in a Power Pivot Data Model in Excel
Question details
The user needs to group calculated ages into specific ranges (bins) within a Power Pivot Data Model.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Creating a PivotTable from a Data Model where standard grouping features are unavailable.
- Observed behavior
- Standard PivotTable grouping is disabled for Data Model sources, preventing the direct creation of age ranges like 15-20 or 21-25.
Ensure that the Power Pivot add-in is enabled in your Excel application and that your data table containing the age values is already loaded into the Data Model.
Create Age Bins Using a DAX Calculated Column
Since standard grouping is disabled for Data Model PivotTables, you must create a calculated column in Power Pivot using DAX to categorize the ages manually.
Data Model PivotTables do not support the native 'Group' feature found in standard PivotTables. To work around this limitation, you can use the DAX SWITCH function inside Power Pivot to evaluate each age and assign it to a predefined text label representing your desired age bin.
Click on 'Manage' within the Power Pivot tab on the Excel ribbon to open the Power Pivot window.
Navigate to the table containing your age data, scroll to the far right, and click on 'Add Column'.
In the formula bar, enter the following DAX formula: =SWITCH(TRUE(), [Age]<=20, "15-20", [Age]<=25, "21-25", [Age]<=30, "26-30", "31 or more"). Make sure to replace [Age] with the actual name of your age column.
Press Enter to apply the formula. Right-click the new column header and rename it to 'Age Bins' or 'Age Group'.
Return to your Excel worksheet. The new 'Age Bins' field will now be available in your PivotTable Fields list to drag into the Rows or Columns area.

Use WPS Office for Easy Data Grouping
If you find Power Pivot and DAX formulas too complex for straightforward tasks, WPS Office offers a lightweight, free alternative to Microsoft Office. WPS Spreadsheet supports standard PivotTables, allowing you to group numbers and dates natively without the need to build a complex Data Model.
- 1. Download WPS Office: Visit the official WPS website to download and install the free office suite on your device.
- 2. Open your dataset: Launch WPS Spreadsheet and open your existing Excel workbook containing the raw data.
- 3. Group data natively: Insert a standard PivotTable, right-click your age field in the Rows area, and select 'Group' to define your bin sizes instantly without formulas.

Frequently Asked Questions
Why is the Group option grayed out in my PivotTable?
The native Group option is automatically disabled when a PivotTable is created from the Excel Data Model (Power Pivot) rather than a standard worksheet range. You must use DAX calculated columns to group data in a Data Model.
Can I use the IF function instead of SWITCH to create age bins?
Yes, you can use nested IF statements in DAX (e.g., =IF([Age]<=20, "15-20", IF([Age]<=25, "21-25", ...))), but the SWITCH function is generally preferred because it is easier to read, write, and maintain for multiple conditions.
How do I sort the age bins correctly in the PivotTable?
Because age bins are text strings, they sort alphabetically by default (e.g., "5-10" might appear after "15-20"). To fix this, create a separate numeric 'Sort Order' calculated column in Power Pivot, select your Age Bins column, and use the 'Sort by Column' feature to sort it based on the numeric column.




