Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Join us March 10th, 7 ways modern analytics can help you take smarter action. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
doublepsa
Contributor II
Contributor II

Min between two dates

Good afternoon, folks!

I'm trying to calculate the minimum between two dates in a KPI script but I'm facing some errors. 

I tried the following: 

=min(data_final+tamanho_durante, Date#('18/02/2021','DD/MM/YYYY'))
 
But Qlik can't calculate this minimum.
 
When I calculate only data_final+tamanho_durante or Date#('18/02/2021','DD/MM/YYYY'), the result is the expected, so I guess the problem is with the min function.
 
data_final is a variable in format date 'DD-MM-YYYY' and tamanho_durante is a integer.
 
Could you please help me? Thanks in advance!
Labels (2)
1 Solution

Accepted Solutions
doublepsa
Contributor II
Contributor II

Hi, @QFabian , I tried what you suggested but where Date=data_final+tamanho_durante, but I couldn't reach the expected result...

Fortunately, I was able to find the solution using RangeMin instead of Min:

=RangeMin(Date#('18/02/2021','DD/MM/YYYY'),num(data_final)+tamanho_durante)

Thanks for your support!

View solution in original post

4 Replies
QFabian
Specialist
Specialist

Hi  @doublepsa , please try this :

=Date(min(num(data_final)+tamanho_durante), 'DD/MM/YYYY')

QFabian
doublepsa
Contributor II
Contributor II

Hi @QFabian this works here, Qlik understands it and gives back the correct date.

But the problem is that I want to calculate the mininum date between this variable date (data_final+tamanho_durante) and a fixed date '18/02/2021'.

Do you know how I could do this?

QFabian
Specialist
Specialist

Hi @doublepsa , i just created this and works, please check your date separator, in my case '-'

QFabian_0-1614097488100.png

 

QFabian
doublepsa
Contributor II
Contributor II

Hi, @QFabian , I tried what you suggested but where Date=data_final+tamanho_durante, but I couldn't reach the expected result...

Fortunately, I was able to find the solution using RangeMin instead of Min:

=RangeMin(Date#('18/02/2021','DD/MM/YYYY'),num(data_final)+tamanho_durante)

Thanks for your support!

View solution in original post