Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I used the following script to convert the date format, but the result included some null values. How do I correct null values ?
Date(Date#([Original Eff Date],'YYYYMMDD'),'MM/DD/YYYY') as [Orgeffdate]
My ultimate objective is to subtract today's date - the original effective date, then divide by 365 to calculate the years insured as follows:
Floor(Today())-Floor(Date(Date#([Original Eff Date],'YYYYMMDD'),'MM/DD/YYYY')))/365 as Yrsinsured
The syntax in the latter script is incorrect, how do I fix it ?
This?
T1_Active:
LOAD [Entity Status],
[Policy Type],
[Profession Flag],
[Customer No],
[Account No],
[Original Eff Date],
[Policy Eff Date],
[Termin Date],
[Student Flag],
[Source Code],
[State Code],
[Base Premium],
Date(Date#(Text([Original Eff Date]),'YYYYMMDD'),'MM/DD/YYYY') as [Orgeffdate],
(Floor(Today())-Floor(Date#([Original Eff Date],'YYYYMMDD')))/365 as Yrsinsured
FROM
Active.xlsx
(ooxml, embedded labels, table is Active);
NoConcatenate
T2_Term:
LOAD [Entity Status],
[Policy Type],
[Profession Flag],
[Customer No],
[Account No],
[Original Eff Date],
[Policy Eff Date],
[Termin Date],
[Student Flag],
[Source Code],
[State Code],
[Base Premium],
Date(Date#(Text([Original Eff Date]),'YYYYMMDD'),'MM/DD/YYYY') as [Orgeffdate],
(Floor(Today())-Floor(Date#([Original Eff Date],'YYYYMMDD')))/365 as Yrsinsured
FROM
Term.xlsx
(ooxml, embedded labels, table is Term);
May be some of the [Original Eff Date] are not in YYYYMMDD format, is that true? If that's true, you need to use Alt function for QlikView to understand different type of date formats. If that above is true, can you tell us what all formats do you have for [Original Eff Date] field?
The original effective date field is a number field that includes numbers in YYYYMMDD format without exception.
My ultimate objective is to subtract today's date - the original effective date, then divide by 365 to calculate the years insured as follows:
Floor(Today())-Floor(Date(Date#([Original Eff Date],'YYYYMMDD'),'MM/DD/YYYY')))/365 as Yrsinsured
If that is true, than I don't see any reason why there should be any nulls. Can you may be do a side by side comparison of each of row to check which values turn to be nulls?
LOAD Date(Date#([Original Eff Date],'YYYYMMDD'),'MM/DD/YYYY') as [Orgeffdate],
[Original Eff Date]
and then create a table box object to see all those places where Orgeffdate is null.
I had already done this, but still could not explain null values.
How about trying it out like this:
Date(Date#(Text([Original Eff Date]),'YYYYMMDD'),'MM/DD/YYYY') as [Orgeffdate],
I copied your script, ran it, got syntax error.
I reran your script with the comma at end, script ran fine, but still have null values.
Would you be able to share few of the dates from the sample above as text and I will try it out at my end.
Best,
Sunny