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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Dynamically grouping table based on user input

Say you have a table like the below where max margin and min margin represent the max and min of margin within the existing table:

CountryMarginMax MarginMin Margin
Germany508040
UK708040
USA808040
Japan558040
China408040

 

Is there a way to allow users to create some kind of grouping, like the "Region" column below, where max and min margin now calculate within the group?

CountryRegionMarginMax MarginMin Margin
Germany1507050
UK1707050
USA2808080
Japan3555540
China3405540
5 REPLIES 5
tamerj1
Super User
Super User

Hi @Anonymous 
This is one simplified example. In real case you would need to add more conditions inside the SWITCH statement.

Please refer to attached sample file with the proposed solution

1.png2.png

 

Anonymous
Not applicable

I probably should've been more clear, the Region grouping does not exist in the source data. They want to be able to assign the groupings on their own and then have the calculations change.

@Anonymous 

 Unfortunately, Power Bi does no have artificial intelligence features at least for now. 

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating new columns in the table.

 

Jihwan_Kim_0-1676608587589.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
wdx223_Daniel
Super User
Super User

Max Margin=CALCULATE(MAX(Table[Margin]),ALL(Table[Country]))

Min Margin=CALCULATE(MIN(Table[Margin]),ALL(Table[Country]))

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.