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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamically Change Date

Hi,

let's assume I have a date '03-11-2015' as start date.

Now I want to write a logic

if start date is less than '01-01-2017'

then

start date = '01-01-2017'

else

don't change the start date.

pls assist.

4 Replies
maxgro
MVP
MVP

Date(RangeMax( date#('03-11-2015', 'DD-MM-YYYY'), MakeDate(2017)))

Date(RangeMax( date#(StartDate, 'DD-MM-YYYY'), MakeDate(2017)))

Not applicable
Author

I am new to Qlikview. Can you pls share the exact condition.

ahaahaaha
Partner - Master
Partner - Master

Hi,

May be like this?

If([start date] < '01-01-2017', '01-01-2017', [start date]) as [start date]

vishsaggi
Champion III
Champion III

What Massimo expression does is below:

Reference: QV Ref Guide.

rangemax(expr1 [ , expr2, ... exprN ])

Returns the highest numeric values found within a range of 1 to N arguments. If no numeric value is found, NULL is returned.

RangeMax(Date#('03-11-2015', 'DD-MM-YYYY')) = This will return 42311

RangeMax(MakeDate(2017))                                = This will return 42736

So out of these two numbers It will pick the max number which is 42736 which is 01-01-2017.

So Date(RangeMax(Date#('03-11-2015', 'DD-MM-YYYY'), MakeDate(2017))) - Will return 01-01-2017

For eg: IF your start date is like 15-03-2017.


RangeMax(Date#('15-11-2017', 'DD-MM-YYYY') ) will return 42809 which is greater than 42736 so the start date will be Date(42809) which is '15-11-2017'.


Hope this gives you some clear idea.