Forum Discussion

gmasta1129's avatar
gmasta1129
Icon for Resolver I rankResolver I
1 year ago
Solved

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).  ...
  • Bibiano_Geraldo's avatar
    1 year ago

    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:

     

     

  • Ashish_Mathur's avatar
    1 year ago

    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.