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
Anonymous
Not applicable

Filter records from Power BI Summarize table

Hi,

 

I have create a below table in Power BI. I need to get max region value for each Id.

 

Below is the DAX I am using to cretae a table in Power BI:

 

Capture.PNG

 

I need to add one more clause which should return max region for each Id.

In case of Id 2 there are two rows, I need to get only one row with Max region value. So the output should be:

 

IdRegion
1APAC
2EMEA
3NAMER

 

Can anyone please help me on that?

 

Thanks!

2 ACCEPTED SOLUTIONS
mahoneypat
Microsoft Employee
Microsoft Employee

Not sure how you are calculating your "max" but here is a table expression that gets your desired result from your example table.  This one determines max alphabetically, but you can substitute in another expression inside the CALCULATE if that is not correct.

 

Main Summary =
ADDCOLUMNS (
    SUMMARIZE ( Main, Main[Id] ),
    "Region", CALCULATE ( MAX ( Main[Region] ) )
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Anonymous
Not applicable

Hi @mahoneypat , @amitchandak ,

 

Thank you so much for your reply!

I tried the below expression and it works perfect.

 

Emp_Count_Region = SUMMARIZE(FILTER(SUMMARIZE(Main , Main[Id], Main[Region] ),
RANKX(
FILTER(SUMMARIZE(Main , Main[Id], Main[Region]), Main[Id]=EARLIER(Main[Id])
),
CALCULATE(count('Main'[Region]), ALLEXCEPT(Main, Main[Id], Main[Region])) , , DESC
) =1
), Main[Id], "Region1", calculate(max(Main[Region])))
 
Thanks!
Rinku

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , if the basis of Max names, why Rank then?

 

Try like

summarize(Table, Table[id], "Region",max(Table[Region]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @mahoneypat , @amitchandak ,

 

Thank you so much for your reply!

I tried the below expression and it works perfect.

 

Emp_Count_Region = SUMMARIZE(FILTER(SUMMARIZE(Main , Main[Id], Main[Region] ),
RANKX(
FILTER(SUMMARIZE(Main , Main[Id], Main[Region]), Main[Id]=EARLIER(Main[Id])
),
CALCULATE(count('Main'[Region]), ALLEXCEPT(Main, Main[Id], Main[Region])) , , DESC
) =1
), Main[Id], "Region1", calculate(max(Main[Region])))
 
Thanks!
Rinku
mahoneypat
Microsoft Employee
Microsoft Employee

Not sure how you are calculating your "max" but here is a table expression that gets your desired result from your example table.  This one determines max alphabetically, but you can substitute in another expression inside the CALCULATE if that is not correct.

 

Main Summary =
ADDCOLUMNS (
    SUMMARIZE ( Main, Main[Id] ),
    "Region", CALCULATE ( MAX ( Main[Region] ) )
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


marceloVVR
Helper I
Helper I

Try using the DISTINCT function. After SUMMARIZE, DISTINCT (Main (ID).

maybe work

Anonymous
Not applicable

Hi @marceloVVR ,

 

Thanks for the reply!

I need to select max region for each id. Using distinct it would be difficult to achieve the desire record.

 

Thanks,

Rinku

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.