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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.