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
tim_g
Regular Visitor

How to get top value, then related value

I have a column of country codes that can occurs many times (us, ca, us, us, au, etc). I have another column with 2 words of text describing things about the country (nice + sunny, cold + rainy, etc):

1, us, warm + sunny 

2, ca, cold + icy

...

 

In another table (related by id) I have a measure that calculates the growth (current month count - prev month count) based on the submitted date:

1, 2nd Jan 2016

2, 4th Dec 2016

...

 

If I do a chart with: 

Axis:    CountryCode

Value:  Growth 

 

Then Order by growth desc, then select the top value ('ca', 120%), I can have a word cloud that shows the top word combination that people used to describe 'ca'. If I limit the word cloud to a single result, it shows the most common combination, 'cold + snowy'. 

 

I want to do the same, but using DAX. How to I extract this value 'cold + snowy' without having the user have to actually click the top value in the chart? I.e I want to show in the middle of the report, the most common words used in the fastest growing country.

 

Thanks!

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @tim_g,

 

According to your description, you should be able to use TOPN Function (DAX) and SUMMARIZE Function (DAX) to create a measure to get the top value in this scenario. The sample below is for your reference.

 

I assume you have the two tables like below.

Table1

t1.PNG

Table2

t2.PNG

 

1. Use the formula below to create a calculate table to get the "Id" with top Growth.

 

TopTable = 
TOPN (
    1,
    SUMMARIZE ( Table2, Table2[Id], "TotalGrowth", SUM ( Table2[Growth] ) ),
    [TotalGrowth]
)

toptable.PNG

 

 

2. Then you should be able to use the formula below to create a measure to get the top value and show it within a Card visual on the report.

 

TopValue = 
CALCULATE (
    FIRSTNONBLANK ( Table1[Description], 1 ),
    FILTER ( Table1, Table1[Id] = MAX ( 'TopTable'[Id] ) )
)

topvalue.PNG

 

 

Here is the sample pbix file for your reference.

 

Regards

View solution in original post

1 REPLY 1
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @tim_g,

 

According to your description, you should be able to use TOPN Function (DAX) and SUMMARIZE Function (DAX) to create a measure to get the top value in this scenario. The sample below is for your reference.

 

I assume you have the two tables like below.

Table1

t1.PNG

Table2

t2.PNG

 

1. Use the formula below to create a calculate table to get the "Id" with top Growth.

 

TopTable = 
TOPN (
    1,
    SUMMARIZE ( Table2, Table2[Id], "TotalGrowth", SUM ( Table2[Growth] ) ),
    [TotalGrowth]
)

toptable.PNG

 

 

2. Then you should be able to use the formula below to create a measure to get the top value and show it within a Card visual on the report.

 

TopValue = 
CALCULATE (
    FIRSTNONBLANK ( Table1[Description], 1 ),
    FILTER ( Table1, Table1[Id] = MAX ( 'TopTable'[Id] ) )
)

topvalue.PNG

 

 

Here is the sample pbix file for your reference.

 

Regards

Helpful resources

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

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.

Top Solution Authors