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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
vBoniniArt
Contributor II
Contributor II

Show column if two strings are equal

Hi, I have the following problem:

My table looks like this

KEY   NAME   PRODUCT    OLD_ID    NEW_ID      OLD_COUNTRY       NEW_COUNTRY

1        AAA          FFF            2             3                    IT                                 IT

2        BBB         GGG          4              5                     USA                            FR

3       DDD          HHH          6             7                     GB                               ES

 

I would like to see the row blank if the old data is different than the new data:

KEY   NAME   PRODUCT    OLD_ID    NEW_ID      OLD_COUNTRY       NEW_COUNTRY

1        AAA          FFF            2             3                     

2        BBB         GGG          4              5                     USA                            FR

3       DDD          HHH          6             7                     GB                               ES

 

 

I'm using the "show column if" in the column of the table like this (ignore the red, it's an example):    

vBoniniArt_0-1730892523808.png

 

but I still see the data also if they are the same (already trimmed, same type...)

 

What can I do?

1 Solution

Accepted Solutions
Kushal_Chawda

@vBoniniArt  try below condition

 

=$(=sum(if(OLD=NEW,1))) <> $(=COUNT(NEW))

 

View solution in original post

12 Replies
tresesco
MVP
MVP

You probably are trying to hide the VALUEs of the columns rather than the COLUMN itself. Try using the measure itself instead of 'show column if' condition.

vBoniniArt
Contributor II
Contributor II
Author

Hi, I'm trying to hide the values of the columns if there are no differences, but also hide the columns if there are no differences at all in any rows

vBoniniArt
Contributor II
Contributor II
Author

I added a calculated column if(old=New, 'The same','Different') and as you can see they are the same in every row... but the "show column if" with "old<>new"  is still not working

 

vBoniniArt_0-1730900908781.png

 

tresesco
MVP
MVP

Try a condition like:
=Not Max(OLD=NEW)

vBoniniArt
Contributor II
Contributor II
Author

Thank you, but this columns contains strings, not numbers, there are also values like "F38Z2" 

Qrishna
Master
Master

there are few methods to achieve this, easiest ones are:


//1. if backend code can be used:
Data:
Load * Inline [
KEY,NAME,PRODUCT,OLD_ID,NEW_ID,OLD_COUNTRY,NEW_COUNTRY
1,AAA,FFF,2,3,IT, IT
2,BBB,GGG,4,5,USA,FR
3,DDD,HHH,6,7,GB,ES
];

Qualify *;
d:
Load KEY,NAME,PRODUCT,OLD_ID,NEW_ID,
if(OLD_COUNTRY=NEW_COUNTRY, OLD_COUNTRY) as OLD_COUNTRY,
if(OLD_COUNTRY=NEW_COUNTRY, NEW_COUNTRY) as NEW_COUNTRY
resident Data;

//2. if front end code can be used:
Dims: KEY,NAME,PRODUCT,OLD_ID,NEW_ID
Measures:
Measure1 = if(OLD_COUNTRY=NEW_COUNTRY, OLD_COUNTRY)
Measure2 = if(OLD_COUNTRY=NEW_COUNTRY, NEW_COUNTRY)

 

2491092 - Show column if two strings are equal.PNG

vBoniniArt
Contributor II
Contributor II
Author

Yeah ok I tried the measures, but if the OLD column and NEW columns have ALL THE VALUES EQUALS, I want to hide these columns. 

 

IF I have a table like this:

ID     OLD1     NEW1     OLD2     NEW2

1         1          1                aa         aa

2         4          5                bb         bb

3         6           7                cc         cc

 

the output should be:

ID     OLD1     NEW1            

1                                       

2         4          5                  

3         6           7                  

Qrishna
Master
Master

you mentioned: I would like to see the row blank if the old data is different than the new data

Kushal_Chawda

@vBoniniArt  try below condition

 

=$(=sum(if(OLD=NEW,1))) <> $(=COUNT(NEW))