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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Previous value in dimension

Goodmorning,

I have created a pivot table with some calculated fields about a trip. In this table I would like to attach the same information about the previous and the following/next trip (via drill-down).

So, I'm looking for a solution to calculate a dimension on a specific field (Tripnumber) that shows the previous and next value, related to that Tripnumber and an other field (Vehicle number). Note the previous Tripnumber is not the Tripnumber - 1 !!

Any suggestions?

Thanks in advance.

Johann

6 Replies
Not applicable
Author

Hi Johann,

you can first organize your table by an "order by", then use in the script previous(Tripnumber) as PrvTripNb to store it in your table.

To get previous and next ,start from 'next' and use previous (previous(Tripnumber)), you get then TripNb as next, previous as current and prev(prev)) as previous

You can then simply use these 3 fields close one to each other

you can use the "above" function in the pivot

here is an quick example

best regards

christian

Not applicable
Author

Hi Christian, this is not exactly what I mean. You used the functions as an expression and not as a dimension.

I need to calculate a dimension with these functions to create this kind of report :

Trip + kilometers, hours etc.
Previous Trip kilometers, hours etc.
( Next Trip kilometers, hours etc.)

Do you have any other suggestions?

Best regards,

Johann

Not applicable
Author

Hej Johann,

can you show me a screen shot of the chart you want please

christian

Not applicable
Author

Christian, I can't show a screenshot, because I don't have the solution yet.

I need some kind of structure (where Trip, Related Trips, Loading Location, Unloading Location and Date/Time are dimensions and Kilometers and Hours are expressions) :

TripRelated TripsCustomerLoading locationUnloading locationDate/TimeKilometersHours
2
-
AAB9-9-2010 14:002005
1BCD8-9-2010 12:003507
3CEF10-9-2010 8:0060014


Note: the main line is Trip 2. From this line I need to show the Previous (1) and Next (3) trip with the info about dimensions and expressions.

Best regards,

Johann

Not applicable
Author

Johann,

I think this will match your needs.

But you'll have to manage previous when it is first as

best regards

christian

Not applicable
Author

Christian,

It's not exactly what I need, but I think I will make a workaround with an other pivot table with other dimensions.

Thanks for your help.

Best regards,

Johann