Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
KristianK
Contributor
Contributor

Load script data where Date XY

Hi,

I am new to Qlik Sense and have a small question regarding my script.

LOAD text("Item No_"),
text("Sales Type"),
text("Sales Code"),
Date("Starting Date",'DD.MM.YYYY'),
"Unit Price",
if("Ending Date" <=Today(),Date("Ending Date",'DD.MM.YYYY')) ;

SQL SELECT "Item No_",
"Sales Type",
"Sales Code",
"Starting Date",
"Unit Price",
"Ending Date"

I want to load this data from via an ODBC connection. I want only data where the "Ending Date" is "<= today", otherwise I have million entries... can somebody tell me what I did wrong in the bold section?

Thank you in advance for your help!

1 Solution

Accepted Solutions
Anil_Babu_Samineni

I would strongly recommend this?

LIB CONNECT TO 'Nav'

Prices:
LOAD
text("Item No_"),
text("Sales Type"),
text("Sales Code"),
Date("Starting Date",'DD.MM.YYYY'),
"Unit Price" as Cijena,
Date("Ending Date",'DD.MM.YYYY')  WHERE "Date("Ending Date",'DD.MM.YYYY') <=Date(Today(),'DD.MM.YYYY');

SQL SELECT "Item No_",
"Sales Type",
"Sales Code",
"Starting Date",
"Unit Price",
"Ending Date"

FROM "XY".dbo."XY$Sales Price";

If you want in SQL you need to use 

DATE_FORMAT("Ending Date",'DD.MM.YYYY');

 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

7 Replies
KristianK
Contributor
Contributor
Author

I changed to "Where" function but it' is not working. I want to show data where the ending Date is ='01.01.1753' or  >= Today

But i get this error message that "Today" is not understood. Any help would be appreciated. Thank you

clipboard_image_0.png

Anil_Babu_Samineni

Perhaps this?

LOAD text("Item No_"),
text("Sales Type"),
text("Sales Code"),
Date("Starting Date",'DD.MM.YYYY'),
"Unit Price",
"Ending Date" Where Date("Ending Date",'DD.MM.YYYY") <= Date(Today(), 'DD.MM.YYYY');

SQL SELECT "Item No_",
"Sales Type",
"Sales Code",
"Starting Date",
"Unit Price",
"Ending Date"

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
KristianK
Contributor
Contributor
Author

Unfortunately no, same Error message

clipboard_image_0.png

A specific date is working (WHERE "Ending Date"<='01.01.1753') but I need also to show every Price that has Ending Date >=Today

Anil_Babu_Samineni

If you show that error, That means you are writing in SQL end not the Qlik area. So, Are you not doing preceding load for SQL table? If so can you post full script?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
KristianK
Contributor
Contributor
Author

I use the Editor for SQL . This is the whole code:

LIB CONNECT TO 'Nav'

Prices:
LOAD
text("Item No_"),
text("Sales Type"),
text("Sales Code"),
Date("Starting Date",'DD.MM.YYYY'),
"Unit Price" as Cijena,
Date("Ending Date",'DD.MM.YYYY') ;

SQL SELECT "Item No_",
"Sales Type",
"Sales Code",
"Starting Date",
"Unit Price",
"Ending Date"

FROM "XY".dbo."XY$Sales Price" WHERE "Ending Date"<='01.01.1753';

Anil_Babu_Samineni

I would strongly recommend this?

LIB CONNECT TO 'Nav'

Prices:
LOAD
text("Item No_"),
text("Sales Type"),
text("Sales Code"),
Date("Starting Date",'DD.MM.YYYY'),
"Unit Price" as Cijena,
Date("Ending Date",'DD.MM.YYYY')  WHERE "Date("Ending Date",'DD.MM.YYYY') <=Date(Today(),'DD.MM.YYYY');

SQL SELECT "Item No_",
"Sales Type",
"Sales Code",
"Starting Date",
"Unit Price",
"Ending Date"

FROM "XY".dbo."XY$Sales Price";

If you want in SQL you need to use 

DATE_FORMAT("Ending Date",'DD.MM.YYYY');

 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
KristianK
Contributor
Contributor
Author

Thank you very much appreciate the help!