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: 
Not applicable

Reverse references

Hi, i have a table with items transfers between docks. This looks like:

ITEMFROMTOTRANSFER_ID
PRODUCT 1DOCK1DOCK2A001
PRODUCT 2DOCK2DOCK3A002
PRODUCT 3DOCK2DOCK3B003
PRODUCT 2DOCK3DOCK1A003
PRODUCT 1DOCK2DOCK1B004
PRODUCT 3DOCK3DOCK1A004
PRODUCT 1DOCK1DOCK3B005

I need make a pivot table to show the number of transfers between docks - this is easy - and change the color of cross transfers product - this is a product moved from dock A to dock B and moved from dock B to dock A. The result pivot table may look like:

DOCK1DOCK2DOCK3
ITEMDOCK2DOCK3DOCK1DOCK3DOCK1DOCK2
PRODUCT 1111
PRODUCT 211
PRODUCT 311

I try with make variables to check the cross transfers:

vDockFrom = Only(FROM);

vDockTo = Only(TO);

=IF (COUNT ({$< FROM={'$(#=vDockTo)'}, TO={'$(#=vDockFrom)'} >} DISTINCT TRANSFER_ID)>0, RGB(255,204,0) )

but this don't work.

Anyone can help me?

1 Solution

Accepted Solutions
Not applicable
Author

I make this solution to extend the graph with interval time.

Extend the original table with a "code" to represent the relation between docks. I.E. Dock A to Dock B and Dock B to Dock A is coded "TA_B" in a new field.

'T'& RangeMinString( right(FROM,1), right(TO,1) ) &'_'& RangeMaxString( right(FROM,1), right(TO,1) ) AS CODE,

ITEMFROMTOTRANSFER_IDCODE
PRODUCT 1DOCK1DOCK2A001T1_2
PRODUCT 2DOCK2DOCK3

A002

T2_3
PRODUCT 3DOCK2DOCK3B003T2_3
PRODUCT 2DOCK3DOCK1A003T1_3
PRODUCT 1DOCK2DOCK1B004T1_2
PRODUCT 3DOCK3DOCK1A004T1_3
PRODUCT 1DOCK1DOCK3B005T1_3

And the Pivot Table Graph is:

FROMDOCK1DOCK2DOCK3
TODOCK2DOCK3DOCK1DOCK3DOCK1DOCK2
ITEMCODET1_2T1_3T1_2T2_3T1_3T2_3
PRODUCT 1111
PRODUCT 211
PRODUCT 311

Expresion:

=COUNT(DISTINCT TRANSFER_ID)

BackGround:

= IF (COUNT(DISTINCT TRANSFER_ID)<>COUNT(DISTINCT TOTAL <ITEM,CODE> TRANSFER_ID), RGB(255,205,0) )

With this solution i can show cross transfers products for a interval date of transactions.

Thanks to jpe‌ to light the path.

View solution in original post

11 Replies
JonnyPoole
Former Employee
Former Employee

Here is an example. 

Capture.PNG

sunny_talwar

I think it is the color that isn't working for him Jonathan

sunny_talwar

Try this as your background color expression:

If(((FROM = 'DOCK1' and TO = 'DOCK2') OR (FROM = 'DOCK2' and TO = 'DOCK1')) and

(Count(DISTINCT TRANSFER_ID)) > 0, RGB(255,204,0))


Capture.PNG

Not applicable
Author

Hi, thanks but, my problem is the color of cell.

Not applicable
Author

I need make work this solution for "N" docks. Because we have a variable number of docks and i need detect all cross reverse transfers.

sunny_talwar

Not really sure what you mean. Do you mean something like this?

DOCK1 -> DOCK2 and DOCK2 -> DOCK1 (Color1)

DOCK1 -> DOCK3 and DOCK3 -> DOCK1 (Color2)

DOCK2 -> DOCK3 and DOCK3 -> DOCK2 (Color3)

and so on...

JonnyPoole
Former Employee
Former Employee

Oh ya..  the whole 'hard part' thing .

Here is a data model solution

Capture.PNG

Capture2.PNG

JonnyPoole
Former Employee
Former Employee

Which sets it up for the UI color check

Capture3.PNG

Not applicable
Author

Think in 3 docks today and 10 docks tomorrow and all docks can transfer items to other docks.