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

One way and back way data compare

I have a table, which have depature and arrivel Information.  When I choose city A to city B in Dimension. The information of B to A will be also back.

I need pairwise comparition. Like this,

Fromto
AB
BA
BA
AC
CA

How can I write Expression? 

ps. Dimension

FromToRoutekilometer
ABA-B100
ACA-C150
BAB-A200
CAC-A250
1 Solution

Accepted Solutions
sinanozdemir
Specialist III
Specialist III

Hi,

Is this what you are looking for?

Capture.PNG

The expression I used was:

Capture.PNG

View solution in original post

8 Replies
sunny_talwar

So when you select A and B, you would also want to see B to A?

JonnyPoole
Former Employee
Former Employee

Can you share some data ?  

Also, why is A-B and B-A different distances ? (also A->C and C->A different)

Are you attempting to accumulate the distances (round trip) or are they just vastly different routes being taken for reverse journeys? 

sinanozdemir
Specialist III
Specialist III

Hi,

Is this what you are looking for?

Capture.PNG

The expression I used was:

Capture.PNG

Not applicable
Author

Thank you very much. And more, I have ein Problem in Ranking. I want to first make a ranking, then show the top 3 route and their back way. what can I do the Ranking, in Dimension or in Expression?

Top 3

C-A 250

B-A 200

A-C 150.


And their back way ,

C-A 250

A-C 150


B-A 200

A-B 100


A-C 150

C-A 250  hier don't show, because this is duplicated.


sinanozdemir
Specialist III
Specialist III

My suggestion would be to rank the routes by kilometer in the load script:

Capture.PNG

So it becomes a dimension and easy to deal with. And then put a dimension filter to show only the top 3 routes based on kilometers:

Capture.PNG

Now, you are only showing the top 3 routes:

Capture.PNG

When you choose a different combo, you are still keeping the ranking and showing the back route of the chose combo:

Capture.PNG

Hope this helps.

Not applicable
Author

Thanks Sinon.

sinanozdemir
Specialist III
Specialist III

You are welcome.

Not applicable
Author

Hi, Happy new year!

I have another question. When I use only function, I don't change script. How can I caculate the summe of two directions.

For exaple, sum(A-B and B-A).

Thank you very much.