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
gmasta1129
Resolver I
Resolver I

Find Largest Value, then pull value in another column based off each portfolio code

Hello,

 

I am looking to create a new column where the formula pulls the value in column C, based off the highest value in column B. Also, this needs to be done by each portfolio code (column A).  

 

Example #1, portfolio code "30022", the highest value in column B is 5. The new column I am trying to create should pull in the value from column C which is 50.  But this should pull in for all rows that contain portfolio code 30022.  

 

Example #2, portfolio code "30015", the highest value in column B is 4.  The new column I am trying to create should pull in the value from column C which is 25.  But this should pull in for all rows that contain portfolio code 30015.

 

gmasta1129_0-1732305467814.png

 

2 ACCEPTED SOLUTIONS
Bibiano_Geraldo
Super User
Super User

HI @gmasta1129 ,

You can achieve your goal by creating a new calculated colum using the following DAX:

New Column = 
VAR MaxValue = 
    CALCULATE(
        MAX('Table'[Value]),
        ALLEXCEPT('Table', 'Table'[Portfolio Code Value])
    )
RETURN
    CALCULATE(
        MAX('Table'[Value #2]),
        'Table'[Value] = MaxValue,
        ALLEXCEPT('Table', 'Table'[Portfolio Code Value])
    )

 

Your table now should look like this:

Bibiano_Geraldo_0-1732309062045.png

 

 

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

Column = LOOKUPVALUE(Data[Value #2],Data[Value],CALCULATE(max(Data[Value]),FILTER(Data,Data[Portfolio Code]=EARLIER(Data[Portfolio Code]))),Data[Portfolio Code],Data[Portfolio Code])

Hope this helps.

Ashish_Mathur_0-1732335239088.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

Column = LOOKUPVALUE(Data[Value #2],Data[Value],CALCULATE(max(Data[Value]),FILTER(Data,Data[Portfolio Code]=EARLIER(Data[Portfolio Code]))),Data[Portfolio Code],Data[Portfolio Code])

Hope this helps.

Ashish_Mathur_0-1732335239088.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Bibiano_Geraldo
Super User
Super User

HI @gmasta1129 ,

You can achieve your goal by creating a new calculated colum using the following DAX:

New Column = 
VAR MaxValue = 
    CALCULATE(
        MAX('Table'[Value]),
        ALLEXCEPT('Table', 'Table'[Portfolio Code Value])
    )
RETURN
    CALCULATE(
        MAX('Table'[Value #2]),
        'Table'[Value] = MaxValue,
        ALLEXCEPT('Table', 'Table'[Portfolio Code Value])
    )

 

Your table now should look like this:

Bibiano_Geraldo_0-1732309062045.png

 

 

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.