Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

Getting the min and max date based on a group using set expressions

Hi all,

 

I have a dataset which is unit record level data, to count the number of units per group I created some variables. For example, if I want to count the units the last 7 days or 8-14 days I created an indicator such as 1 and 2, and this works fine. This table only have one single observation but the real table have multiples as-is unit record data.

What I need to do now is to create dynamic titles for these particular groups. For example, I need to get the min and max date for group 1, and group 2 and so on. Please see below a very small example in excel.

Date_varGroup 
1/01/20201
2/01/20201
3/01/20201
4/01/20201
5/01/20201
6/01/20201
7/01/20201
8/01/20202
9/01/20202
10/01/20202
11/01/20202
12/01/20202
13/01/20202
14/01/20202
15/01/20203
16/01/20203
17/01/20203
18/01/20203
19/01/20203
20/01/20203
21/01/20203

 

In this example, i want to display the min date for group 1, and I tried and it did not work

min(date( {$ [Group] ={1}>} ))

Thanks 

Ian

 

Tags (2)
Labels (1)
1 Reply
Highlighted
MVP
MVP

Re: Getting the min and max date based on a group using set expressions

Try like:

date(min( {<[Group] ={1}>} Date_var))

or, if your date values are strings:

date(min( {<[Group] ={1}>} Date#(Date_var, 'DD/MM/YYYY')))