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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
thiagofnds
New Member

Compare one column to all the others

Hello!

 

I am not sure if this is the best way of doing this but I have 2 different tables, one with a reference and the other one with the evaluation of the people. I need to compare the evaluation column of each person to one of the activities reference in the other table and then give a grade to each person accordingly to the evaluation. In table 2 we just have binary evaluation, someone has or not a skill, table 2 has levels, 0, 1, 2 and 3. I am just adding some data similar to what I have.

 

Table 1 - Reference 

Skill codeActivitie 1 Activitie 2
CG002.932
CG001.1022
CG002.210

 

Table 2 - People

SkillPerson 1Person 2Person 3
CG002.9101
CG001.10101
CG002.13101
CG002.7001
CG002.2011
CG001.1000

 

What I need is to compare each column in table 2 to all columns in table 1 and have this result for each person and each activitie:

Person 1 doesn't have all level 1 skills for activitie 1 

Person 2 has all level 1 skills for activitie 1

Person 3 has all level 1 skills for activitie 1

 

Thanks in advance

2 REPLIES 2
thiagofnds
New Member

Thank you very much for your reply.

 

Well, I think it solves part of the problem. Actually the goal is to check if, for example, Person 1 has all Level 1 skills for activitie 1. Then do it to all other people and activitie levels and give them grades based on these criteria:

 

If (has all level 2 and level 3) -> min_grade = 7

esleif(has all level 3) -> min_grade = 4

else -> min_grade = 0

grade = min_grade + 3*(all level 1 that a person has)/(all level 1 of the activitie)

So that the max grade would be 10.

 

 

The result table should be something like this (with random numbers for grades here as example):

PersonActivitie 1Activitie 2Activitie 3
Person 17104
Person 2154,5
Person 3387,8

 

I did it on Excel (a not very elegant or automated (but easy) solution) but it seems to be way harder to do in Power BI.

 

I used the formula below to each grade, where colums A to DY are the activities and DY until the end are the people:

 

=IFERROR(IF(COUNT.IF(Compilado!A2:A1117;"3";Compilado!$DY$2:$DY$1117;1)+COUNT.IF(Compilado!A2:A1117;"2";Compilado!$DY$2:$DY$1117;1)>=CONT.IF(Compilado!A2:A1117;"3")+CONT.IF(Compilado!A2:A1117;"2");7;
IF(COUNT.IF(Compilado!A2:A1117;"3";Compilado!$DY$2:$DY$1117;1)>=CONT.IF(Compilado!A2:A1117;"3");4;0)) +
3*COUNT.IF(Compilado!A2:A1117;"1";Compilado!$DY$2:$DY$1117;1)/CONT.IF(Compilado!A2:A1117;"1");0)

 

 

v-yadongf-msft
Community Support
Community Support

Hi @thiagofnds ,

 

Please unpivot columns for ‘people’ table in Power Query like shown below:

vyadongfmsft_0-1662025174658.png

 

You will get a table like this:

vyadongfmsft_1-1662025174659.png

 

The relationship between two tables:

vyadongfmsft_2-1662025174660.png

 

Please try following DAX to create a measure:

Measure = 
VAR _VALUE = SELECTEDVALUE('People'[Value])
VAR _ACT = MAX('Reference'[Activitie 1])
RETURN
IF(_VALUE = 1, _ACT)

 

Create a table visual, you can give a grade to each person accordingly to the evaluation.

vyadongfmsft_3-1662025174665.png

 

If I misunderstand your demands, please feel free to contact us in time.

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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