This function returns an integer representing the minute when the fraction
of the expression is interpreted as a time
according to the standard number interpretation.
Syntax:
minute(expression)
Return data type: integer
When to use it
The minute() function is useful when you would like to compare aggregations by minute. For example, you could use the function if you would like to see activity count distribution by minute.
These dimensions can be created either in the load script by using the function to create a field in a Master Calendar table. Alternatively, they can be used directly in a chart as a calculated dimension.
Function examples
Example
Result
minute (
'09:14:36' )
Returns 14.
minute (
'0.5555' )
Returns 19 ( Because 0.5555 = 13:19:55 ).
Regional settings
Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples.
Default regional settings in apps are based on the regional system settings of the computer or server where Qlik Sense is installed. If the Qlik Sense server you are accessing is set to Sweden, the Data load editor will use Swedish regional settings for dates, time, and currency. These regional format settings are not related to the language displayed in the Qlik Sense user interface. Qlik Sense will be displayed in the same language as the browser you are using.
Example 1 – Variable (script)
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset containing transactions by timestamp, which is loaded into a table called Transactions.
The default TimeStamp system variable (M/D/YYYY h:mm:ss[.fff] TT) is used.
The creation of a field, minute, to calculate when transactions took place.
Load the data and open a sheet. Create a new table and add this field as a dimension: timestamp.
Create the following measure:
=minute(timestamp)
Results table
timestamp
minute
2022-01-01 22:10:22
10
2022-01-02 08:35:54
35
2022-01-03 05:40:49
40
2022-01-03 14:21:53
21
2022-01-04 18:49:38
49
2022-01-04 22:58:34
58
2022-01-05 19:04:57
4
2022-01-05 19:34:46
34
2022-01-06 08:49:09
49
2022-01-06 11:29:38
29
The values for minute are created by using the minute() function and passing the timestamp as the expression in a measure for the chart object.
Example 3 – Scenario
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset of timestamps, which is generated to represent entries at a ticket barrier.
Information with each timestamp and its corresponding id, which is loaded into a table called Ticket_Barrier_Tracker.
The default TimeStamp system variable (M/D/YYYY h:mm:ss[.fff] TT) is used.
The user would like a chart object that shows, by minute, the count of barrier entries.
Load script
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
tmpTimeStampCreator:
load
*
where year(date)=2022;
load
date(recno()+makedate(2021,12,31)) as date
AutoGenerate 1;
join load
maketime(floor(rand()*24),floor(rand()*59),floor(rand()*59)) as time
autogenerate 10000;
Ticket_Barrier_Tracker:
load
recno() as id,
timestamp(date + time) as timestamp
resident tmpTimeStampCreator;
drop table tmpTimeStampCreator;
Results
Do the following:
Load the data and open a sheet. Create a new table.
Create a calculated dimension using the following expression:
=minute(timestamp)
Add the following aggregation measure to calculate total count of entries:
=count(id)
Set the measure's Number formatting to Money.
Results table
minute(timestamp)
=count(id)
0
174
1
171
2
175
3
165
4
188
5
176
6
158
7
187
8
178
9
178
10
197
11
161
12
166
13
184
14
159
15
161
16
152
17
160
18
176
19
164
20
170
21
170
22
142
23
145
24
155
+ 35 more rows
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!