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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sushantk19
Creator
Creator

Difference of 2 dates in decimal places issues

hello,

I have the below requirement:

Date1 : 2017-01-25 

Date2: 2017-03-21 

I have to calculate the no of months from the above 2 dates: The output should be upto 2 decimal places like 1.86 and not 2. I used the below logic in tmpa:

Load_data.Subscription_Cancelled!=null?TalendDate.diffDate(Load_data.Subscription_Cancelled,Load_data.Subscription_Created,"MM"):0.00 

but the result i get with this diffdate function is a integer number and not exact 2 decimal value. Is it possible to get this result in any other way or using some other function?

Labels (2)
1 Reply
sushantk19
Creator
Creator
Author

i have used the the below query:

 

select 

Subscription_id,

customer_id,

subscriptionsource,

active_flag,

subscriptioncreated_at,

subscriptiondeleted_at,

subscription_brand,

initialorders_id,

initial_shipping_country_id,

shipping_country_id,

rank() over ( partition by customer_id order by subscriptioncreated_at ) Rank,

rank() over ( partition by customer_id,subscription_brand

order by subscriptioncreated_at ) Rank1,

round(months_between(subscriptiondeleted_at,subscriptioncreated_at),2) cancelled_subscription_not_null,

round(months_between(getdate(),subscriptioncreated_at),2) cancelled_subscription_null

from "+context.Redshift_Schema_DM+".dim_subscription 

 

the round function gives accurate results. BUt i get a warning message in the tDBinput component as "Parameter(query): schema is different for the query". Although i have defined 14 columns in my Edit schema which is same as no of columns in SQL query.

 

How to get RID of this warning? the job runs fine and gives correct result. Its just that this job shows up this warning message.