Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
dyee4613
Helper I
Helper I

Dynamic Grouping

I'm building a report that classifies people on income.  I've created a measure to sum up their wage and then a long if statement to classify what range the user falls into.  The issue is my report needs to look like this:

 Under 30Under 60Over 60
0-10,0005112
10,001-20,000135
20,001-30,0001 8

 

The problem is I'm not sure how to dynamically group the numbers so it will modify as the date changes.  Initially, I built a measure that calculates total wages and then created another measure to group them into each class.  However, I can not use the measure for the rows in my Matrix.  I tried to switch it to a calculated column but the calculated column will not change based on the date. 

 

Anyone have any ideas?  I was thinking a stand alone table with all my groupings and then referencing them with a measure would work but I'm not sure how to do that.

2 REPLIES 2
dax
Community Support
Community Support

Hi dyee4613,

I am not sure your data structure, you could refer to my design:

My sample

name month amount older
a 1 10 3
a 2 20 3
a 3 20 3
a 4 30 3
a 5 50 3
b 1 10 5
b 2 2 5
b 3 30 5
b 4 20 5
b 5 5 5
c 1 10 3
c 2 50 3
c 3 60 3
c 4 9 3
c 5 50 3
d 1 20 5
d 2 30 5
e 1 100 5
e 2 20 5
e 3 50 5

I create a column like below

 

category =
VAR temp =
    CALCULATE ( SUM ( 'sum'[amount] ), ALLEXCEPT ( 'sum', 'sum'[name] ) )
RETURN
    SWITCH (
        TRUE (),
        temp < 100, "<100",
        temp < 150, "100-150",
        temp < 200, "150-200",
        temp > 200, ">200"
    )

 

 

Then create a measure like below

Measure = CALCULATE(distinctCOUNT('sum'[name]), ALLEXCEPT('sum','sum'[older],'sum'[category]))

309.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Ashish_Mathur
Super User
Super User

Hi,

Share data in a form that can be pasted in an Excel workbook.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.