Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Highlighted
rohi__
New Contributor II

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.

2 Replies
Ezir
Contributor II

Re: Calculate Differences in a Column

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__
New Contributor II

Re: Calculate Differences in a Column

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!