Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am new to Qlik sense.
I have this logic that if the key is the same and it has value for Variable1 (blue, purple) then assign 'Colors' to variable2, same goes for (cat, dog), assign animals.
Can this be done in Qlik sense, if so, how?
Key | Variable1 | Variable2 |
1 | Blue | Colors |
1 | Purple | Colors |
2 | Cat | Animal |
2 | Dog | Animal |
3 | Blue | Sky |
4 | Dog | Pet |
Many thanks for the help.
@williamhayes May be you can try something like below:
Mapping_table:
Mapping load * inline [
Variable1, Variable2
Blue, Colors
Purple, Colors
Cat, Animal
Dog, Animal
];
Temp:
Load Key,
Variable1,
ApplyMap('Mapping_table',Variable1,'Not found') as Variable2
inline [
Key,Variable1
1, Blue
1, Purple
2, Cat
2, Dog
];
exit script;
You might need an extra table to do the mapping.
@sidhiq91 Thanks for your input. I have updated my question.
What about the combination? Only when Blue and orange in the same key can be assigned 'colors', will the mapping still works?
Let's say for
Key 1 [Blue, Orange] = Colors,
Key 3 [Blue]=Sky
Apologies for the confusion.
@williamhayes Yes it would still work provide we do not have ',' in between Blue and Orange:
You can provide some sample data for me work around if required.