Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ToinkToinkTigger
Contributor
Contributor

Date format

Hi there,

I have a column with date values. The format from the source is:

6/7/2022 08:49 PM Europe/Berlin

 

I would like to use the built-in calendar measurement in QS, however it does not regognize values as a date value.

Tried to split the field into pieces to extract the ''D/M/YYYY" however, did not get this to work.

Perhaps I can change the date format in the script loader? Would appreciate some help 🙂 Thanks

 

Labels (1)
3 Solutions

Accepted Solutions
brunobertels
Master
Master

Hi 

you need to Name your dimension : 

 

Date(......subfield(....))) AS "Completion date" ,

View solution in original post

canerkan
Partner - Creator III
Partner - Creator III

This is the line you need to user in your load script:

Date(Date#(SubField("Completion Date",' ',1),'D/M/YYYY')) as "Completion Date",

Then use Dimension "Completion Date" in your Visualization.

 

If it's still not working, can you provide some sample data?

View solution in original post

canerkan
Partner - Creator III
Partner - Creator III

You can do that yourself by using Date Functions like Month etc. in your load script. Or create a Mastercalendar.

Check the link below for a pretty good collection of information to that topic by @marcus_sommer :

https://community.qlik.com/t5/QlikView-Documents/How-to-use-Master-Calendar-and-Date-Values/ta-p/149...

 

View solution in original post

19 Replies
brunobertels
Master
Master

Hi 

try this 

subfield('6/7/2022 08:49 PM Europe/Berlin',' ',1) 

Extract the part before the first blank space so here 6/7/2022

then to insure the date format of the expression : 

date(date#(subfield('6/7/2022 08:49 PM Europe/Berlin',' ',1),'DD/MM/YYYY'),'DD/MM/YYYY')

 

hope it helps 

canerkan
Partner - Creator III
Partner - Creator III

Hi ToinkToinkTigger,

First you have to find out what data type your field has. Is it a string or date or Timestamp?

Timestamps are decimal numbers and date values are integers. Therfore changing the format might change it's appearance but not the value itself and that could be the reason your Field is not recognised as a date value. You have to floor your timestamp value to get an integer value of the date. Try adding this line to your load statement in your load script:

Date(Floor(YourDateField)) as Date

If it's not working your field might be a string value and you might need to extract the date part from your field beforehand and then use this instead:

Date(Floor(Date#(YourDateStringField))) as Date

Let me know if it helped.

Regards

Can

sidhiq91
Specialist II
Specialist II

@ToinkToinkTigger  Please use the below code in the script load editor:

NoConcatenate
Temp:
Load Date(Date#(SubField(Date,' ',1),'D/M/YYYY'),'DD/MM/YYYY') as Date

inline [
Date
6/7/2022 08:49 PM Europe/Berlin
];

Exit Script;

If this resolves the issue, please like and accept it as a solution.

ToinkToinkTigger
Contributor
Contributor
Author

I tried this line of code, but it results in a corrupted dashboard (no data visible)

ToinkToinkTigger
Contributor
Contributor
Author

Thanks, where exactely do I put this code? In the main of the editer loader where dateformat is set or perhaps the editor where the column is being loaded?

canerkan
Partner - Creator III
Partner - Creator III

Where the columns are loaded

ToinkToinkTigger
Contributor
Contributor
Author

So how would that look like?, the column with the date fields is ''completion date''

ToinkToinkTigger_0-1663932625344.png

 

canerkan
Partner - Creator III
Partner - Creator III

like this in the first solution:

Date(Floor("Completion Date")) as CompletionDate,

But for the second solution you would need to extract the string date beforehand, like @sidhiq91 suggested. Maybe like this:

Date(Floor(Date#(SubField("Completion Date",' ',1),'D/M/YYYY'))) as CompletionDate,

ToinkToinkTigger
Contributor
Contributor
Author

Unfortunately both solutions dont work... Still not able to make a calendar measurement.