cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrothschild
Helper V
Helper V

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 IV
Super User IV

@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!

Proud to be a Super User!

Website   YouTube    LinkedIn

View solution in original post

2 REPLIES 2
mrothschild
Helper V
Helper V

@Fowmy Thanks so much!  Works perfectly!

Fowmy
Super User IV
Super User IV

@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!

Proud to be a Super User!

Website   YouTube    LinkedIn

View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors