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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Expression help

Hi,

It would be much appreciated if someone could help with the following.

I am trying to restrict a straight table/pivot table to only show pairs of information.  For example:

Field 1          Field 2

QuoteA         QuoteB

QuoteA         QuoteC

QuoteA         QuoteD

QuoteB         QuoteA

QuoteB         QuoteC

QuoteB         QuoteD

Using the above example, I would like to only see where Field 1 is QuoteA and Field 2 is QuoteB OR where Field 1 is QuoteB and Field 2 is QuoteA.

Thanks for your help.

Regards,

Daniel

3 Replies
Not applicable

Daniel,

try this set analysis:

sum(${<Field1={"QuoteA"}, Field2={"QuoteB"}>+<Field1={"QuoteB"}, Field2={"QuoteA"}>}, Sales)

where <set1>+<set2>, the + meaning OR

Fabrice

MayilVahanan

Hi


Try like this

sum({<Field1={"QuoteA"}, Field2={"QuoteB"}>+<Field1={"QuoteB"}, Field2={"QuoteA"}>}Sales)


I would like to only see where Field 1 is QuoteA and Field 2 is QuoteB :

sum({<Field1={"QuoteA"}, Field2={"QuoteB"}>} Sales)


Field 1 is QuoteB and Field 2 is QuoteA:

sum({<Field1={"QuoteB"}, Field2={"QuoteA"}>}Sales)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Jason_Michaelides
Partner - Master II
Partner - Master II

First question - Are Field 1 and Field 2 in the same table?  If so, I would put something in the script like:

IF(

     (Field1 = 'Quote A' AND Field2 = 'Quote B') OR

     (Field1 = 'Quote B' AND Field2 = 'Quote A')

     ,1,0)                                                                 AS     ShowFlag

Then, in your chart have an expression like:

     Sum(Sales*ShowFlag)

You could create multiple different flags this way if there were other variations you require...

If they are not in the same table then the above set analysis solutions are probably best.