Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing field Data

Hi All,


Question. I have data from two different resources which I have linked together using a concatenated key:

article+color+size+amount as article_key.

This is loaded into the table differentiating them using a custom Table field. (one is loaded as 'table1' as Table, the other 'table2' as Table).

The list looks as follows:

article_keyTable
trouser-900-34-20table1
trouser-900-34-20table 2
sweater-999-XL-10table1
sweater-999-XL-15table2

What I want to do know is to create a statement in which the sweater-999-XL-15 gives a different color since it is only available in table2 and not in table1. Is it possible to compare data like this?

Please let me know.

Kind regards,
Maarten

1 Solution

Accepted Solutions
maxgro
MVP
MVP

in a chart with article_key as dim you can use the following expression

if(Only(Table)='table2',red())

1.png

View solution in original post

8 Replies
sunny_talwar

May be create a flag for the entry in the script and use that to color it:

Table:

LOAD * Inline [

article_key, Table

trouser-900-34-20, table1

trouser-900-34-20, table2

sweater-999-XL-10, table1

sweater-999-XL-15, table2

];

Join(Table)

LOAD If(article_key = Peek('article_key'), 1, 0) as Flag,

  article_key,

  Table

Resident Table

Order By article_key, Table;

Output:

Capture.PNG

Not applicable
Author

Hi!


Thanks for your reply, but it doesn't seem to be the answer.

sunny_talwar

You want to color articles in table 2 which do not have a matching article in table1, right??? At least that's how I interpreted your situation. What are you trying to do, if above is not what you want???

rubenmarin

Hi Maarten, if that is an expression in a table you can set the font color like:

If(Count(DISTINCT Table)<2 and Table<>'table1', Red(), Black())

maxgro
MVP
MVP

in a chart with article_key as dim you can use the following expression

if(Only(Table)='table2',red())

1.png

qlikviewwizard
Master II
Master II

Hi,

Can you please upload your sample file to demonstrate your issue?

Thank you.

Not applicable
Author

This is a great answer. It works and immediately visualizes the results. Thank you!

Not applicable
Author

Im now trying to add this to the script for calculations. Is this possible. Im getting different results.

My script looks like:

NoConcatenate

DATA:

LOAD

Article_Key,

Concat(DISTINCT Table, ' & ') as TABLE_FLAG

Group By KEY_ARTIKEL;

Or is there a way to calculate results for 'table 1' , 'table 1 & table 2' or 'table 2' seperately?

cheers,

Maarten