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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Timestamp calculation

Hi guys,

please I have this timestamp format in my database timestamp= 2016-11-01 00:00:00.0000000 +00:00 and I convert it to this format Date = 2016-11-01  by using this expression :    Date#(SubField(timestamp, ' ', 1),'YYYY-MM-DD')

I want whenever I choose a date for example 2016-11-01, I want to get the value of this timestamp 2016-11-01 05:59:57.1810000 +00:00.

Please help me.

13 Replies
rubenmarin

Hi Lou, what I see is a text box with the expression "=sum(VTagResolvedVirtual.ValueFloat)", so it sums all the values because the expression tells QV to sum the dates, you can use Min() or Max() to retrieve only one value.

Another option can be creating another table that loads the different dates and create the timestamp in this table, so there will be only one timestamp for each different date:

LOAD Distinct VTagResolvedVirtual.ValueFloat,

          Timestamp(Date#(SubField(VTagResolvedVirtual.TimeStamp, ' ', 1),'YYYY-MM-DD') + $(vTimeToSum), 'YYYY-MM-DD hh:mm:ss.fffffff +00:00') as DD

Resident ...

Not applicable
Author

Hi Ruben,

I tried before the expression : =Sum({<DD = {">=$(=Timestamp(Floor(Min(DD))+num(Maketime(05:59:57))))<=$(=Timestamp(Floor(Max(DD))+num(Maketime(05:59:57)))))"}>}VTagResolvedVirtual.ValueFloat)

but it didn't work, it also gives me the some for all the timestamps of the chosen date.

rubenmarin

Hi Lou, that's what I said above, if you use Sum() QV will sum, and if it has x times the same value it will summ the x values, the option to add another table is to load only one value of each date, ahve you created this related table?

If you created the table maybe it's still retrieving more than one value for each date... there is only one VTagResolvedVirtual.TimeStamp for each VTagResolvedVirtual.ValueFloat? In that case maybe forcing to store only one value:

LOAD VTagResolvedVirtual.ValueFloat,

          Timestamp(Date#(SubField(Min(VTagResolvedVirtual.TimeStamp), ' ', 1),'YYYY-MM-DD') + $(vTimeToSum), 'YYYY-MM-DD hh:mm:ss.fffffff +00:00') as DD

Resident ...

Group By VTagResolvedVirtual.ValueFloat;

The Min() should be a MinString() if VTagResolvedVirtual.TimeStamp is a string.

Not applicable
Author

Hi ruben,

I tried you solution and I created the table and I used group by, but I still get the sum of all the timestamps