Power BI - Find the % matching (Bounty 100) What-if analysis before and after

China☆狼群 提交于 2019-12-01 08:24:28

The key here is to have distinct unrelated tables for your slicers.

Let's call your original table Jobs.

Create two new tables:

Role = DISTINCT(Jobs[Role])
Skills = DISTINCT(Jobs[Skills])

Now that we have these tables, we can create slicers with them and read the selected values into our measures.

% Skill Match =
VAR SelectedRole = SELECTEDVALUE ( Role[Role] )
VAR RelatedSkills = CALCULATETABLE ( DISTINCT ( Jobs[Skills] ), Jobs[Role] = SelectedRole )
VAR CurrentSkills = DISTINCT ( Jobs[Skills] )
RETURN
    DIVIDE (
        COUNTROWS ( INTERSECT ( RelatedSkills, CurrentSkills ) ),
        COUNTROWS ( CurrentSkills )
    )

This reads in your selected role in the first variable. When we upskill, we read in the other slicer as well:

% Skill Match Upskilled =
VAR SelectedRole = SELECTEDVALUE ( Role[Role] )
VAR SelectedSkills = VALUES ( Skills[Skills] )
VAR RelatedSkills = CALCULATETABLE ( DISTINCT ( Jobs[Skills] ), Jobs[Role] = SelectedRole )
VAR CurrentSkills = DISTINCT ( Jobs[Skills] )
VAR Upskilled = DISTINCT ( UNION ( RelatedSkills, SelectedSkills ) )
RETURN
    DIVIDE (
        COUNTROWS ( INTERSECT ( Upskilled, CurrentSkills ) ),
        COUNTROWS ( CurrentSkills )
    )

The unused skill measure is very similar.

Unused Skills =
VAR SelectedRole = SELECTEDVALUE ( Role[Role] )
VAR SelectedSkills = VALUES ( Skills[Skills] )
VAR RelatedSkills = CALCULATETABLE ( DISTINCT ( Jobs[Skills] ), Jobs[Role] = SelectedRole )
VAR CurrentSkills = DISTINCT ( Jobs[Skills] )
VAR Upskilled = DISTINCT ( UNION ( RelatedSkills, SelectedSkills ) )
RETURN
    CONCATENATEX ( EXCEPT ( Upskilled, CurrentSkills ), Jobs[Skills], ", " )

The result should look something like this:

You can add some logic to hide the role you've selected in the matrix visual, but I'm keeping things simpler here.

Hmm I think the key here is a good model.

The Idea is I am trying to show - How much percentage the skillsets of the selected role is matching with another role.

For the first question you need to define the relationships to evaluate the matches and calculate, based on that, a percentage. I would do the following:

Creating the MaxSkillTable:

JobID    JobName               Skill
 1       Business Analyst     Power-Bi
 1       Business Analyst     SSRS
 1       Business Analyst     Excel
 2       Other jobs           Other skills for other jobs
 ...and so on

Lets say now you select Max Mustermann for Business Analyst on your Person table and get the following result:

     Name         Skill    JobID   
 Max Mustermann   Excel      1     
 Max Mustermann   SSRS       1

Now you need to match the result above mit the MaxSkillTable where the JobID is the same. You will get two matches (Excel and SSRS). This would be your first result. After that you can select the maximal skills count for this job (Excel, SSRS, Power-BI = 3). This would be the second result. When you have this both results you can calculate the percentage.

For Max Mustermann it would be 2 / 3 so ca. 66%.

For your second question,

How much percentage the skillsets of selected role is matching with another role after upskilling.

you can simualte an increasement of the count of Max Mustermanns skills. The result for his query were two skills . So 2 + 1 = 3. Now calculate the percentage based on this increasment again. 3 / 3 = 1 = 100% (here you need to take care to not increase the count over the maximum).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!