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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
alespooletto
Creator II
Creator II

How to get a User's start and complete date time for each of the unique IDs of a product?

Hello, I have a QVD file that contains the following information:

  • User
  • Unique ID of a product
  • DateTime 
  • A flag with either Complete or Start 

Now, I want to show in a table, at what time did each of the users start and complete a certain product. I tried using a Pivot table, but this seems unnecessary and expansive in computational terms. Is there an easier way to do this?

Ideally, it shoul look like this:

alespooletto_0-1703144077669.png



Labels (2)
1 Solution

Accepted Solutions
vincent_ardiet_
Specialist
Specialist

You can create a straight table with User and SFC has dimensions, then 2 measures:

=Min({<Flag={Start}>}DateTime)
=Max({<Flag={Complete}>}DateTime)

View solution in original post

6 Replies
vincent_ardiet_
Specialist
Specialist

You can create a straight table with User and SFC has dimensions, then 2 measures:

=Min({<Flag={Start}>}DateTime)
=Max({<Flag={Complete}>}DateTime)

alespooletto
Creator II
Creator II
Author

Thank you, that was a quick and simple fix. 

alespooletto
Creator II
Creator II
Author

Sorry, I don't want to open yet another thread for this question. Could you please help me figure out, is there a way to obtain an average duration of the difference between these two fields you suggested me here?

vincent_ardiet_
Specialist
Specialist

Like this?
Avg(Max({<Flag={Complete}>}DateTime)-Min({<Flag={Start}>}DateTime))

alespooletto
Creator II
Creator II
Author

Thank you, sorry I just got back from the holidays. It seems like the measure doesn't work, as nested aggregations are not allowed, but I will work on a solution myself starting from this. 

 

vincent_ardiet_
Specialist
Specialist

Yes, my bad, you need to use AGGR in this case:
Avg(Aggr(Max({<Flag={Complete}>}DateTime)-Min({<Flag={Start}>}DateTime),User,SFC))