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

Number "2" Value represented as '1900-01-01'

Hello,

it's happening to me something really strange... maybe you could send some light to find why.

the thing is that i have two fields that in database are of type "int" and are converted in the queries to nvarchar, also in database, then i load that data in Qlik Sense like this:

 

LIB CONNECT TO 'SQL_PRD';
DQ_REGISTRY:
LOAD ID AS ID_REGISTRY,
    "EXEC_DATE",
    "DQ_ID" AS ID_DQ,
    "REG_ID",
    "COL_NAME",
    "COL_VALUE",
    "EXEC_INTERVAL_ID" AS EXEC_INTERVAL_ID_REGISTRY;
SQL SELECT ID,
    "EXEC_DATE",
    "DQ_ID",
    "REG_ID",
    "COL_NAME",
    "COL_VALUE",
    "EXEC_INTERVAL_ID"
FROM CDB.dq."DQ_REGISTRY";

 

 

Values are stored in "COL_VALUE" column, which is a nvarchar(max).

And if i try to represent the data in a table, all "2" values are converted into "1900-01-01".
The funny thing is that if i show that value in a KPI, the number "2" is show, so the conversion to "1900-01-01" only happens in table views.

This is what i get from the table:

Morgoz_0-1619601409119.png

This is the expression that i use for the KPI (it shows a "2" correclty):

 

Max({<LOAD_DATE = {'2021-04-28'}, REG_ID = {479}, COL_NAME={'FLOTA_VIVA'}>}COL_VALUE)

 

 

Do you know why could this happen?

Thank you.

2 Replies
Digvijay_Singh

Looks like you got COL_VALUE field as Date type when loaded in the Qlik. Date type fields are always have two parts, numeric and text. KPI is showing numeric value 2' because you have used MAX aggregate function. Max always uses/show numeric value of the date.

May be try NUM while loading this field in the script.

Morgoz
Contributor III
Contributor III
Author

Thank you Digvijay,

but all values in COL_VALUE are nvarchar and like that they are imported in QlikSense. 
It is not possible to me to use NUM for all COL_VALUEs since there are text, number, dates, etc, but all formatted to nvarchar in database.

Appart, the thing that is making me cracy is why does it happen only with the number "2"? All of the rest numbers are represented correctly in the column...

Thanks again.