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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
94veiga
Helper II
Helper II

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!!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@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])

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

 

94veiga_0-1616597004267.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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