Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Mapping load across multiple tables

Hi all. I have a question regarding a specific mapping problem. So say I have a table called Projects with a field ProjectId. I've got a table called Tasks with fields TaskId and Priority. Priority can be High, Med, Low. I've also got a link table between them called Link with fields ProjectId and TaskId.

I want to create a new field in the Projects table called HighestTaskPriority, which takes all the Tasks that link to a given Project and finds the highest priority of all those tasks. So if Project A links to Tasks 1,2,3 and their respective priorities are high, medium, medium, Project A will have HighestTaskPriority equal to High. Does this make sense?

Does anyone have a good solution for this? I was thinking to use mappings to do this. So I'd have one mapping for each priority and do a nested if statement to pick the highest one for each project.

Please let me know if you have any ideas. Thank you!

1 Reply
johnw
Champion III
Champion III

Maybe this?

LEFT JOIN ([Link])
LOAD
TaskId
,match(Priority,'Low','Medium','High') as NumericPriority
RESIDENT [Tasks]
;
LEFT JOIN ([Projects])
LOAD
ProjectId
,pick(max(NumericPriority),'Low','Medium','High') as HighestTaskPriority
RESIDENT [Link]
GROUP BY ProjectId
;
DROP FIELD NumericPriority
;