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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
INSP7791
New Member

measure reflecting 2nd largest value of another column

Hi,

My table looks like this, I want to create a measure which based on selected GEO, it would return the Industry by the 2nd largest Current Year (000s) value.

tried this

 

topIndustry= CALCULATE (
top ( 'CMA-Industry'[Industry], TRUE () ),
FILTER (
'CMA-Industry',
'CMA-Industry'[Current Year (000s)] = MAXX(TOPN(2, SUMMARIZE('Current Year (000s)', 'CMA-Industry'[Current Year (000s)] )))
)
)

INSP7791_0-1654708276781.png

 

4 REPLIES 4
INSP7791
New Member

should I added 

 

should I add this, then

Var _1 = selectedvalue(CMA-Industry[GEO])
FILTER ( Max2Table, 'CMA-Industry'[GEP] = Var_1)

 

tamerj1
Super User
Super User

Hi @INSP7791 

please try

topIndustry =
VAR Max2Table =
    TOPN ( 2, 'CMA-Industry', 'CMA-Industry'[Current Year (000s)] )
VAR SecondLargest =
    MINX ( Max2Table, 'CMA-Industry'[Current Year (000s)] )
RETURN
    MAXX (
        FILTER ( Max2Table, 'CMA-Industry'[Current Year (000s)] = SecondLargest ),
        'CMA-Industry'[Industry]
    )

Thank you!  I think it's almost good.  Is there a way to also filter by selected GEO as on the page I have a filter allowing users to select the GEO of their choice, this measure should change as per the filter.

@INSP7791 

It should work without having to add additional filters. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.