Forum Discussion

94veiga's avatar
94veiga
Icon for Helper II rankHelper II
5 years ago
Solved

Create a column with the maximun category

Hello, I have tow table like this related by idEmp. I want to create a column in the first table with the info about the principal activity of the employee,  in this case the activity the empolyee gets most of his income.

 

idEmp * (Pk)NamePrincipal Activity  ?????
EMP00001John CenaChef
EMP00002Bon JoviWaiter

 

idEmp *CategorySalary
EMP00001Chef1000
EMP00001Waiter500
EMP00001Kitchen boy200
EMP00002Waiter2000
EMP00002Kitchen700

 

Thank you in advance!!

  • 94veiga , Better to have a rank column in table2

     

    New column in Table 2
    Rank = rankx(filter(Table2, [idemployee] =earlier([[idemployee])),[Salary])

     

     

    New column in table 1 =
    new column = maxx(filter(Table2, Table2[idemployee] = Table1[Idemployee], Table2[Rank]=1),[Category])

2 Replies

  • 94veiga , Better to have a rank column in table2

     

    New column in Table 2
    Rank = rankx(filter(Table2, [idemployee] =earlier([[idemployee])),[Salary])

     

     

    New column in table 1 =
    new column = maxx(filter(Table2, Table2[idemployee] = Table1[Idemployee], Table2[Rank]=1),[Category])

    • 94veiga's avatar
      94veiga
      Icon for Helper II rankHelper II

      Hello, thanks for your support. The first DAX worked perfectly but I'm having problems with the second one.