Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

A condition is always evaluated to 'true' when it is compared to a variable which was assigned to a date value

Hello,

In QlikView I wanted to design a table which displays a column if Year selected-1 is less then or equals to minimum Year available in my data set.

In my code I have the following:

DateRange:

LOAD

    date(min(OrderDate)) as MinimumDate,

    date(max(OrderDate)) as MaximumDate

Resident Facts;


LET $vMinDate = Date(MinimumDate,'DD-MM-YYYY');


In the Condition for the column expression:

(only(Year)-1) >= Year(date(MinimumDate))

correctly does not display this Column when I select the minimum Year in my data set.

However,

(only(Year)-1) >= Year(date(vMinDate))

and

(only(Year)-1) >= Year(date($vMinDate)),

and even (only(Year)-1) >= Year(date#(vMinDate,'DD-MM-YYYY'))

are always evaluated to True which is incorrect.

I would ideally like to drop table dateRange and utilise $vMinDate correctly in the Table Condition.

How can this be accomplished?

Thanks

1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Your variable-creation is wrong. Try it in this way:

DateRange:

LOAD

    date(min(OrderDate)) as MinimumDate,

    date(max(OrderDate)) as MaximumDate

Resident Facts;


LET vMinDate = peek('MinimumDate', 0, 'DateRange');


...

(only(Year)-1) >= Year($(vMinDate))

- Marcu

View solution in original post

1 Reply
Highlighted
MVP & Luminary
MVP & Luminary

Your variable-creation is wrong. Try it in this way:

DateRange:

LOAD

    date(min(OrderDate)) as MinimumDate,

    date(max(OrderDate)) as MaximumDate

Resident Facts;


LET vMinDate = peek('MinimumDate', 0, 'DateRange');


...

(only(Year)-1) >= Year($(vMinDate))

- Marcu

View solution in original post