Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
krishna20
Specialist II
Specialist II

Expression not working

Hi Friends,

my condition is

  if(Pol Expiry Date> SysDate   Then

E.Premium = G.Premium

                      /

                  (Pol Expiry Date - Pol start Date) 

                * (Pol Expiry Date - SysDate)

Else

E.Premium  = G.Premium

I converted this expression as

=if((TP_POL_TO_Date)>Today(),(sum(G.Premium) /

((TP_POL_TO_Date)-(TP_POL_FM_Date)))* ((TP_POL_TO_Date)-Today()),sum(G.Premium))

my dates are in format DD-MM-YYYY

Here , if condition is not working , its directly taking else condition.

What may the issue can anyone pls help out.

Thanks & Regards

kalyankrishna

4 Replies
PrashantSangle

Hi,

Try like this way

=if(Date(TP_POL_TO_Date)>Date(Today(),'DD-MM-YYYY'),(sum(G.Premium) /

((TP_POL_TO_Date)-(TP_POL_FM_Date)))* (Date(TP_POL_TO_Date)-Date(Today(),'DD_MM_YYYY'),sum(G.Premium))

Or

Try like

=if(num(TP_POL_TO_Date)>floor(Today()),(sum(G.Premium) /

((TP_POL_TO_Date)-(TP_POL_FM_Date)))* ((TP_POL_TO_Date)-Today()),sum(G.Premium))

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
tresesco
MVP
MVP

Perhaps your date field is being treated as text, use date#() to convert it to proper date and try like:

=if(Date#(TP_POL_TO_Date,'DD-MM-YYYY')>Today(),(.....

krishna20
Specialist II
Specialist II
Author

Hi ,

No change in this.

Regards

krishna

tresesco
MVP
MVP

Possibly, your date field format is causing the issue. Try to share a qvw with sample data.