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

Why are timestamps in different rows

Hi,

Can someone explain why the timestamps per ID are in different rows? (and how to fix it)

load Id,
if(type=1,Timestamp(timeD)) as Timestamp1,
if(type=2,Timestamp(timeD)) as Timestamp2,
if(type=3,Timestamp(timeD)) as Timestamp3
where statetext='Finished'
from ...

Qliksense_77_0-1664789827741.png

 

 

Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like below

load Id,
max(if(type=1,Timestamp(timeD))) as Timestamp1,
max(if(type=2,Timestamp(timeD))) as Timestamp2,
max(if(type=3,Timestamp(timeD))) as Timestamp3

from urtable
where statetext='Finished'

group by Id;

In that case, u can get in one row.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
Mark_Little
Luminary
Luminary

Hi @Qliksense_77 

Could you supply more details around the data model, With the times being different it suggests there are multiple rows for where the condition is met.

Add ROWNO() AS TestID, 

Seeif you get different row numbers.

Qliksense_77
Creator
Creator
Author

hi @Mark_Little

 

I get different row numbers:

Qliksense_77_0-1664792483515.png

 

 

MayilVahanan

Hi

Try like below

load Id,
max(if(type=1,Timestamp(timeD))) as Timestamp1,
max(if(type=2,Timestamp(timeD))) as Timestamp2,
max(if(type=3,Timestamp(timeD))) as Timestamp3

from urtable
where statetext='Finished'

group by Id;

In that case, u can get in one row.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Qliksense_77
Creator
Creator
Author

hi @MayilVahanan 

This solution works, thank you:)