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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mrothschild
Continued Contributor
Continued Contributor

return label from Column A for summarized column B

I have data similar to the following:

 

CountryCityLocationNumber
USANYA10
USALAB65
USALAC65
UKLondonD60
UKLondonE60
UKBrightonF60

 

Using this code I'm able to get to the MAXIMUM by Country or City:

VAR Exposure =      MAXX(
                        DISTINCT('Table 1'[Country]),
                        CALCULATE(SUM('Table 1'[Number]))
                    )

RETURN 

Exposure

 

Now I'd like to return the Country associated with [Exposure]

 

Thanks!

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@mrothschild 

Returns the country with the largest value:

Country Max = 

var __t = 
    TOPN(1, ADDCOLUMNS(SUMMARIZE(table1,Table10[Country]),"@number", CALCULATE(SUM(table1[Number]))),[@number])
return
    MAXX( __t, table1[Country])

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
mrothschild
Continued Contributor
Continued Contributor

@Fowmy Thanks so much!  Works perfectly!

Fowmy
Super User
Super User

@mrothschild 

Returns the country with the largest value:

Country Max = 

var __t = 
    TOPN(1, ADDCOLUMNS(SUMMARIZE(table1,Table10[Country]),"@number", CALCULATE(SUM(table1[Number]))),[@number])
return
    MAXX( __t, table1[Country])

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors