Forum Discussion

AvalBuroAdmin's avatar
AvalBuroAdmin
Regular Visitor
5 years ago
Solved

Create a Calculated Column using MAX value from another column of the same table

Hi everyone

I have the first 3 columns in this table (tblResources) and I need to create a calculated column (4th column)

IdPersonidResourceResourceCostMaxResourceCostbyPerson
Jhonrss0110002000
Jhonrss0519992000
Jhonrss0220002000
Peterrss0150005000
Peterrss0325005000

 

Wich Dax expression should i use to create the column MaxResourceCostbyPerson, every row should have the MAX value of ResourceCost for that IdPerson.

 

Hopefully someone can help me.

 

Rewards.

 

  • AvalBuroAdmin 

    Add a New Column to your Table:

    Column = 
    CALCULATE(
        MAX(Table1[ResourceCost]),
        ALLEXCEPT(TABLE1,Table1[IdPerson])
    )

     

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

5 Replies

  • AvalBuroAdmin 

    Add a New Column to your Table:

    Column = 
    CALCULATE(
        MAX(Table1[ResourceCost]),
        ALLEXCEPT(TABLE1,Table1[IdPerson])
    )

     

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

    • sunnyzags's avatar
      sunnyzags
      Frequent Visitor

      Hi, 

      I was working on something similar but in my case 2000 for the first person, I want to display 2000 only against it and not the other values which are not the greatest. Something like this.

      dPersonidResourceResourceCostMaxResourceCostbyPerson
      Jhonrss011000 
      Jhonrss051999 
      Jhonrss0220002000
      Peterrss0150005000
      Peterrss032500 
  • There are many ways to do this but here's one option:

     

    MaxResourceCostbyPerson =
    CALCULATE (
        MAX ( TableName[ResourceCost] ),
        ALLEXCEPT ( TableName, TableName[IdPerson] )
    )