Differences between GENERATE and CROSSJOIN - Unplugged #37

https://www.sqlbi.com/tv/differences-between-generate-and-crossjoin-solving-business-scenarios-unplugged-37/ 


Solution:

- Create temporary table of AvailableSkills which includes each employee's skills and level and rows for any level that is less than the employee's skill level

- Create a temporary table of the RequiredSkills for each job requisition

- INTERSECT RequiredSkills and AvailableSkills to get the list of employees who have the minimum skill level for each skill in the job requisition


MS3 =
VAR AvailableSkills =
SELECTCOLUMNS (
GENERATE (
SUMMARIZE ( EmployeeSkills, Skills[Skill Name], EmployeeSkills[Level] ),
FILTER (
SELECTCOLUMNS (
ALLNOBLANKROW ( EmployeeSkills[Level] ),
"@Level", EmployeeSkills[Level]
),
EmployeeSkills[Level] >= [@Level]
)
),
"Skill Name", [Skill Name],
"Level", [@Level]
)
VAR RequiredSkills =
SUMMARIZE ( JobReqs, Skills[Skill Name], JobReqs[Level] )
VAR GoodSkills = INTERSECT ( RequiredSkills, AvailableSkills )
RETURN
DIVIDE ( COUNTROWS ( GoodSkills ), COUNTROWS ( RequiredSkills ) )

Comments

Popular posts from this blog

Difference between DISTINCT and VALUES in DAX