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

Forming a Date column

I want to form a date column for a calendar year.

<Dimension 1>

2018

Jan

1

2

3

.

.

31

Feb

1

2

.

Dec

1

.

.

31

2019

Jan

1

.

etc

I want to form a date using Dimension 1 column.

Expected output = 2018-1-30

Attached data set

Message was edited by: prakash mathiazhagan

1 Solution

Accepted Solutions
PrakashMathi
Contributor III
Contributor III
Author

All,

Thanks for your help.

Got the answer. Below code works and provides answer to my solution.


Table:
LOAD Date,
If(Date > 2000 and IsNum(Date), Date, Peek('Year')) as Year,
If(IsText(Date), Date, Peek('Month')) as Month,
MakeDate(If(Date > 2000 and IsNum(Date), Date, Peek('Year')), Month(Date#(If(IsText(Date), Date, Peek('Month')), 'MMM')), Date) as New_Date
FROM

(
ooxml, embedded labels, table is Sheet1);

FinalTable:
NoConcatenate
LOAD *
Resident Table
Where Len(Trim(New_Date)) > 0;

DROP Table Table;

EXIT SCRIPT;

View solution in original post

9 Replies
Anil_Babu_Samineni

Not sure, I understand the problem. Can you bell on that exactly what you need?

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
shiveshsingh
Master
Master

Do you need a calendar?

PrakashMathi
Contributor III
Contributor III
Author

I want a date column

PrakashMathi
Contributor III
Contributor III
Author

I want a date column in the presentation layer in the format of 2018-1-1, 2018-1-2,etc

shiveshsingh
Master
Master

May be this

let vMin = num(Today());

let vMax = num(Today()+30);

Calendar:

load date($(vMin)+RowNo()-1) as Date

AutoGenerate($(vMax)-$(vMin));

jonathandienst
Partner - Champion III
Partner - Champion III

How should he table containing the date column be associated with the rest of the data model?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
PrakashMathi
Contributor III
Contributor III
Author

it is the single table. There is not any other table in data model

PrakashMathi
Contributor III
Contributor III
Author

Screenshot_2.png

Actually i was thinking of creating another column which will have Jan/Feb/Mar like that and then to concatenate.

PrakashMathi
Contributor III
Contributor III
Author

All,

Thanks for your help.

Got the answer. Below code works and provides answer to my solution.


Table:
LOAD Date,
If(Date > 2000 and IsNum(Date), Date, Peek('Year')) as Year,
If(IsText(Date), Date, Peek('Month')) as Month,
MakeDate(If(Date > 2000 and IsNum(Date), Date, Peek('Year')), Month(Date#(If(IsText(Date), Date, Peek('Month')), 'MMM')), Date) as New_Date
FROM

(
ooxml, embedded labels, table is Sheet1);

FinalTable:
NoConcatenate
LOAD *
Resident Table
Where Len(Trim(New_Date)) > 0;

DROP Table Table;

EXIT SCRIPT;