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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Mickey_124
Contributor
Contributor

Count travels

Hello,

i've got a simple excel, there are 4 columns and ~57000 rows:

IDVehicleStartStop
1Auto1ParisMadrid
2Auto1MadridBerlin
3Auto2MadridParis
4Auto2ParisMadrid
5Auto3BerlinMadrid

 

1 row means 1 travel, for example in the first row Auto1 travels from Paris to Madrid.

I'd like to make a bar chart, where i'd like to count, how many Start-Stop relations i have. It doesn't matter if the Start and Stop location is reversed, if it's the same 2 location. In this little example, we would have bars with the following heights:

3 for Paris-Madrid bar (2 Paris-Madrid + 1 Madrid-Paris)
2 for Madrid-Berlin bar (1 Madrid-Berlin + 1 Berlin-Madrid)

I tried to solve this problem with a new master dimension:
if((Start='Paris' AND Stop='Madrid') OR (Start='Madrid' AND Stop='Paris'),'Paris-Madrid',(if....))
, but i have like 6-700 such relations, so it would be an endless expression.

Do you guys have any good idea?

Thank you in advance!

1 Solution

Accepted Solutions
Vegar
MVP
MVP

By using this script I easily get the table and chart below.

LOAD *,
RangeMinString(Start, Stop)&' - '& RangeMaxString (Start, Stop) as Travel
inline [
ID,Vehicle,Start,Stop
1,Auto1,Paris,Madrid
2,Auto1,Madrid,Berlin
3,Auto2,Madrid,Paris
4,Auto2,Paris,Madrid
5,Auto3,Berlin,Madrid];

image.png

View solution in original post

1 Reply
Vegar
MVP
MVP

By using this script I easily get the table and chart below.

LOAD *,
RangeMinString(Start, Stop)&' - '& RangeMaxString (Start, Stop) as Travel
inline [
ID,Vehicle,Start,Stop
1,Auto1,Paris,Madrid
2,Auto1,Madrid,Berlin
3,Auto2,Madrid,Paris
4,Auto2,Paris,Madrid
5,Auto3,Berlin,Madrid];

image.png