Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
I use banding all the time to group customers into segments. Very easy. But I also have a need to group those bands in a cumulative matrix such that each band has a cumulative total inclusive of the bands above it. You can see the example below:
How would I write the DAX to produce the matrix on the right from the data on the left?
Solved! Go to Solution.
Hi @domtrump
In enclosed file you can find possible solution for Measure Count.
This measure is based on another measures Count 21+ and other, which is based on calculated column Band in Fact table as following
=IF([Age]>=60;"60+";
IF(AND([Age]>=50;[Age]<60);"50+";
IF(AND([Age]>=40;[Age]<50);"40+";
IF(AND([Age]>=21;[Age]<40);"21+";
"21+"))))
Picture for pivot as solution
Picture for Fact table column Band
Proud to be a Super User!
Not sure what other information I can provide to illustrate? I already have a calculated column that puts the customers into an AGE RANGE (such as age 40-49 or 50-59 or 60+). I can easily produce the counts of customers that are in each of the AGE RANGE segments. I want to create a new calculated column that defines them into a new segmentation based on whether or not they are equal to or above a certain age. (i.e. 50+ would be a segment for any patron over 50. this would include the 50-59 AND the 60+ patrons from the example just gave).
Here's a summary of the data model for this example:
So it is just a matter of how to write the DAX in such a way to create these new "buckets" (or groups or segments or cohorts) at the lower levels would include everyone in the levels above it (i.e. 30+ would include anyone 30-39 as well as 40+ and so on).
I could certaily accomplish this with a long IF statement or SWITCH but I was looking for a more eloquent method using something similar to the banding technique.
Let me know if this sheds further clarity or if there is anything else I can post. The link to running totals looks like it might be useful for time-based calculations but not sure how I would apply it to this scenario. Thanks.
Hi @domtrump
In enclosed file you can find possible solution for Measure Count.
This measure is based on another measures Count 21+ and other, which is based on calculated column Band in Fact table as following
=IF([Age]>=60;"60+";
IF(AND([Age]>=50;[Age]<60);"50+";
IF(AND([Age]>=40;[Age]<50);"40+";
IF(AND([Age]>=21;[Age]<40);"21+";
"21+"))))
Picture for pivot as solution
Picture for Fact table column Band
Proud to be a Super User!
Hi @domtrump I will think about it/your case
Proud to be a Super User!
Hmmm. let's try another way just using the basic banding example (I copied this example off the web into my OneNote probably 20+ years ago - it came from this website if it still exists 🙂
<https://exceleratorbi.com.au/banding-in-dax/>
Process for Creating Banding
The better way involves the following process.
Here is the detail of how to do it.
Create a Table in Excel
Here is what a table in Excel looks like.
The key features to note are
Write a Calculated Column
The objective of the calculated column is to filter the disconnected Banding table so that 1 and only 1 row is “visible” or “unfiltered” for each customer. Here is the formula
= CALCULATE(
VALUES(AgeBands[Band]),
FILTER(AgeBands,
Customers[Age] > AgeBands[From] &&
Customers[Age] <= AgeBands[To]
)
)
The new calculated column could then be placed in a pivot table to get the number of customers in each age grouping. Easy stuff.
What I now need is a pivot table that would use similar grouping but instead of grouping into ranges with a top and bottom value, each segment would have a floor but no ceiling. So I could see
-# customers over 60 (customers in the 60+ band)
-# customers over 50 (customers in the 50-59 band PLUS customers in the 60+ band)
-# customers over 40 (customers in the 40-49 band PLUS customers in the 50-59 band PLUS customers in the 60+ band)
and so on...
Hope that helps clarify. If not, let me know what else would be helpful.