Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bartwelvaarts
Contributor III
Contributor III

Substract 2 times in set analysis

Hi,

 

I want to substract 2 times within set analysis. I calculated 2 times:
Only({<Status= {'START'}>}Time) 

Only({<Status= {'Completed'}>}Time) 

But Only({<Status= {'Completed'}>}Time)  - Only({<Status= {'START'}>}Time)  does not work.

I hope somebody can help me

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

@bartwelvaarts , your time field values are possible texts. Try to parse these values like:

Time(Only({<Status= {'Completed'}>} Time#(Time, 'hh:mm:ss')) - Only({<Status= {'START'}>} Time#(Time,'hh:mm:ss')))

View solution in original post

5 Replies
tresesco
MVP
MVP

'does not work' - is a very limited information. Try to share more information on it, like: how  your output look like with that expression and how you expect it to be, how your data look like, etc.

PrashantSangle

What is the output you are getting??

 

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
bartwelvaarts
Contributor III
Contributor III
Author

This is my flat data

bartwelvaarts_14-1600071616223.png

I use : Only({<Status= {'START'}>}Time) & Only({<Status= {'Completed'}>}Time) to get the records on the same row, like the image below.

 

bartwelvaarts_12-1600071583621.png

 

Next, I want to calculate the time between Completed & START. 

I tried :

Only({<Status= {'Completed'}>}Time) - Only({<Status= {'START'}>}Time)

And als tried:

column(2)- column(1)

But both statements result in a NULL value

tresesco
MVP
MVP

@bartwelvaarts , your time field values are possible texts. Try to parse these values like:

Time(Only({<Status= {'Completed'}>} Time#(Time, 'hh:mm:ss')) - Only({<Status= {'START'}>} Time#(Time,'hh:mm:ss')))

bartwelvaarts
Contributor III
Contributor III
Author

Worked perfectly! thank you very much!