Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
venkey2847
Contributor II
Contributor II

Need to show past 15mins data in report

Hi All, 

I have date format like this '18/04/2019 12:50:08'.

I want show only past 15mts data in my bar chart.

How can we achieve that in sex expression. 

My expression now is that. SUM(I'd) 

Please help me with that issue. 

Thanks 

Venkey. 

4 Replies
HirisH_V7
Master
Master

By Creating a variable like this,

vTimeLimit=Timestamp(Now()- Time('00:15:00', 'hh:mm:ss'),'DD/MM/YYYY hh:mm:ss')

Using this in set analysis,

=Count({<Format={">$(=Num(vTimelimit))"}>}ID)

will give you desired result.

Sample Data set used:

Data:
LOAD *,
Num(Timestamp#(Time,'DD/MM/YYYY hh:mm:ss')) as Format
 INLINE [
    ID, Time
    1, 22/04/2019 10:50:08
    2, 22/04/2019 12:50:08
    3, 22/04/2019 12:59:08
];

PFA App for Ref.

HirisH
“Aspire to Inspire before we Expire!”
Vegar
MVP
MVP

The solution of @HirisH_V7 will work, but you did not define your definition of the past 15 minutes. By using the now() function you can get three different outputs depending on which mode you are using (0, 1 or 2).

15 min since last reload:
SUM({<Time={">$(=now(0)- interval#('15', 'mm'))"}>})
This will give you the same output as @HirisH_V7 solution.

15 min since the user calls this measure:
SUM({<Time={">$(=now(1)- interval#('15', 'mm'))"}>})

15 min since the user opened the application:
SUM({<Time={">$(=now(2)- interval#('15', 'mm'))"}>})

 

venkey2847
Contributor II
Contributor II
Author

Thanks for your reply
My date field is like 18/04/2019 12:50:08 AM.
By using my date field I need to identify the maximum date value
From that maxm date value I need to do - 15.(minus 15).
Thanks
Venkey.
Vegar
MVP
MVP

In the script so this:

IntervalTable:
LOAD Max(DateTimeField) as MaxDateTime,
Max(DateTimeField) - interval#('15', 'mm') as TimeLimit;
LOAD FieldValue('DateTimeField' recno()) as DateTimeField
AUTOGENERATE FieldValueCount('DateTimeField');

Let vTimeLimit = peek('TimeLimit', -1, 'IntervalTable');

In your expression do this:
Sum({<DateTimeField={">$(=$(vTimelimit))"}>} Amount)

I assume that your Qlik Sense recognizes your DateTime field as an timestamp.