Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rohi__
Contributor III
Contributor III

Calculate Differences in a Column

Hello everyone,

I have several orders with a cumulative duration. Now I want to calculate the single duration per step.

I have tried this with

If(Order = previous(Order), Previous(cumulated)-cumulated, 0) as single

Now the single time is shifted by one row.

How do I achieve that it's not shifted anymore?

Thank you very much for your support.

Labels (5)
2 Replies
Ezir
Creator II
Creator II

Hello @rohi__ ,

I don't know if I got it right... See

In load editor:

table:
load order, cumulated, If(order = previous(order), cumulated - previous(cumulated), 0) as single inline [
order, cumulated,
1,0,
1,1,
1,3,
1,6,
1,9,
1,10,
1,208,
2,0,
2,3,
2,6,
2,9,
2,10,
2,167,
3,0,
3,1,
3,1,
3,3,
3,4,
3,11,
3,55
];

 Result:

table.png

 

🤔

rohi__
Contributor III
Contributor III
Author

Hi @Ezir ,

I had to order the data properly... 

In the App it showed me the correct sequence but when i looked up the Data Model Viewer it was all messed up.

Thanks for your Reply!