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: 
SRSB
Partner - Contributor III
Partner - Contributor III

Show first record according to TimeStamp

Hello to you all,

I have a table in which I've created a measure that shows if a record is the first one.

The prblem is that when I select a specific date (Only one date) the value of this calculated measure changes (which is normal since the perimeter has changed)

Is there a way to prevent FIRST_ITEM from changing its Value.

FIRST_ITEM = IF (hourPrev= Min(TOTAL<id_item>timestamp(hourPrev, 'YYYY/M/DD hh:mm:ss.ffffff')), 'YES','NO')

1.PNG2.PNG

In the second Photo, FIRST ITEM must show NO, since it's not the record corresponding to the ID 2.

Thank you for your help.

Best Regards.

 

 

1 Solution

Accepted Solutions
Kushal_Chawda

@SRSB  sorry there was a typo. try below

=aggr(IF (hourPrev= timestamp(Min(TOTAL<id_item>{<id_item,hourPrev>}hourPrev),'YYYY/M/DD hh:mm:ss.ffffff'), 'YES','NO'),id_item,hourPrev)

 

View solution in original post

6 Replies
Kushal_Chawda

@SRSB  try below

=only(aggr(IF (only({<id_item,hourPrev>}hourPrev)= Min(TOTAL<id_item>timestamp(only({<id_item,hourPrev>}hourPrev), 'YYYY/M/DD hh:mm:ss.ffffff')), 'YES','NO'),id_item,hourPrev))
Taoufiq_Zarra

@SRSB 

you can change your expression to :

IF (hourPrev=aggr(min({<hourPrev=>}hourPrev),ID_ITEM), 'YES','NO')

 

output:

Capture.PNG

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
SRSB
Partner - Contributor III
Partner - Contributor III
Author

@Kushal_Chawda 

Thank you for your help, unfortuantely it did not work 😭

ssahar_0-1603409183372.png

 

Kushal_Chawda

@SRSB  sorry there was a typo. try below

=aggr(IF (hourPrev= timestamp(Min(TOTAL<id_item>{<id_item,hourPrev>}hourPrev),'YYYY/M/DD hh:mm:ss.ffffff'), 'YES','NO'),id_item,hourPrev)

 

SRSB
Partner - Contributor III
Partner - Contributor III
Author

@Taoufiq_Zarra  Thanks !

But I don't know why it does not show 'YES' for all the first items.

Is it related to the timestamp format ?

3.PNG

Best regards,

SRSB
Partner - Contributor III
Partner - Contributor III
Author

Thank you so much !! 😊