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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculation Mapping Problem/Question

Hello,

I have a pivot/straight table with some calulated with 4 expressions. Each of these expressions calculates a char (A to C)
In an 5 expression I'm putting the 4 expressions together so that I get something similar like "AACB" or "CBAA"

So what I'mt trying to do is this:
I have a mapping/assignmet for my code eg. AACB = Star, CBAA = Dog etc.

I use a separate table where for the assignment.
AAAA =...
AAAB =...
AAAC = .... etc.

(quite a lot)

I'm trying to get the mapping values into an 6th expression so that I can see that AACB = star.

Is this possible (I thouhgt about a long if statement, but this is quite ugly.

Final table should look this:

Customer | Expr1 | Expr2 | Expr3 | Expr4 | Expr5 | Expr6
1 A A C B AACB STAR

Thanks for your help.

Aloah

7 Replies
martin59
Specialist II
Specialist II

Hello,

You can do something like that :

MapTable:
MAPPING LOAD * INLINE [
ID, Value
AACB, Star
CBAA, Dog
BBAC, Value3
];
MyTable:
LOAD *,
applymap('MapTable',Expr5) as Expr6;
LOAD Customer,
Expr1,
Expr2,
Expr3,
Expr4,
Expr1 & Expr2 & Expr3 & Expr4 as Expr5
FROM MyFile.xls (xls);


Hope it helps you

Martin

Not applicable
Author

Is there also an option do this in an expression?

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Try loading a simple table (not a MAPPING table), and in your expression, use something like this:

(assuming your table has fields "OldValue", "NewValue"):

= only( if( OldValue = Column(1) & Column(2) & Column(3) & Column(4) & Column(5), NewValue))

This should work, if your data is not so large for IF formulas...

Not applicable
Author

Hi Oleg,

I tried in a sample app, but I just didn't get it....(see qvw.)

Not applicable
Author

Hello

See this attachment

thanks

Benoît

Not applicable
Author

Hi,

I tried =F2&F3&F4&F5 in an expression name "Concat" instead of Displaying F6

in a second expression I used =if(match([Conc],F2&F3&F4&F5),F7)

This doesn't seem to work. Anyone an idea?

johnw
Champion III
Champion III

Chart "Test" is taking advantage of a table built to map F6 to F7. You've removed F6, so it can't do the mapping. If you really don't want to see F6, here's a way to still use the table without actually including F6 in your chart:

aggr(if(F2&F3&F4&F5=F6,F7),F1,F6)