Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ferha_jafri
Partner - Creator III
Partner - Creator III

Issue with an expression

Hello Everyone,

I have a requirement , in which I want to show a table with a range of date From and To . Here I am facing issue how to get a true condition i an expression if(Log_Date>$(MaxDate),1,0) . PFA with a sample.

Thank you

Regards

Ferha Sharma

1 Solution

Accepted Solutions
ferha_jafri
Partner - Creator III
Partner - Creator III
Author

I used Log_Date={">=$(vFromDate)<=$(vToDate)"}  in the expression.

View solution in original post

9 Replies
pradosh_thakur
Master II
Master II

Hi

can you be a little more specific with your requirement.

regards

Pradosh

Learning never stops.
ferha_jafri
Partner - Creator III
Partner - Creator III
Author

I have a requirement in which I was to pass from date from calendar and to date from calendar and want to display Log date in between from and to dates.

pradosh_thakur
Master II
Master II

Hi

pfa . is this what you are looking for?

regards

Pradosh

Learning never stops.
petter
Partner - Champion III
Partner - Champion III

You should avoid formatted dates when doing logic. It is much better and safer to use the numerical version of the date.

For instance in you application you have:

If( Concat(Log_Date) <= $(vMaxDate) , 1 , 0 )

The Concat() function will concatenate as strings the formatted dates that are selected or possible so you get something like this as a result:

02/10/201703/10/201704/10/201705/10/201706/10/2017

This will be interpreted as a calculation consisting of many divisions and the result is:

5.9904817301955e-30

Similarly the $(vMaxDate) will be this if 04/10/217 is selected and that evaluates to this:

0.00019831432821021

And clearly this is not your intention - is it?

To get what you want you will have to do something like this:

If( Max(Log_Date) <= Num( $(vMaxDate ) ) , 1 , 0 )

ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Hello Pradosh,

Thank for your reply, I need it in a chart as a calculated dimension. Please check when I am using it in a table I am getting false condition.

Thank you

ferha_jafri
Partner - Creator III
Partner - Creator III
Author

I want the dates between Min and Max as If(log_date <=vMaxDate

and log_date <=vMaxDate,log_date)

ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Please find attachment.

pradosh_thakur
Master II
Master II

check this out

regards

Pradosh

Learning never stops.
ferha_jafri
Partner - Creator III
Partner - Creator III
Author

I used Log_Date={">=$(vFromDate)<=$(vToDate)"}  in the expression.