Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
rahulsud007
Creator
Creator

Date generation

IDjanrowno()Year
AO012015
AO122015
AO032015
AO142015
AO152015

Dear Experts, this is the format which I currently have

and I need the output by replacing Rowno with date. Such as

date

1-jan-2015

2-jan-2015

3-jan-2015

4-jan-2015

5-jan-2015. Can you please help me in this?

10 Replies
Not applicable

Hi,

put it like,

rowno()&'-'&Month&'-'&Year as NewDate

rahulsud007
Creator
Creator
Author

Hi harshal, thanks for your Feedback but the thing is that I am not getting the rowno() as 1,2,3,4,5 as I mentioned  it is as such 4021,

4022,4033.. so on

Not applicable

Hi,

try something like that and if your jan is fix in field then you replace in makedate by 1

TEST:

LOAD * inline [

ID, jan ,rowno() ,Year

AO ,0 ,1, 2015

AO ,1, 2, 2015

AO, 0 ,3, 2015

AO ,1, 4, 2015

AO ,1, 5, 2015];

TEST2:

LOAD ID,

MakeDate(Year,jan,rowno()) as date

Resident TEST;

Regards

Vimlesh

senpradip007
Specialist III
Specialist III

Do you have any month field?

Not applicable

Can you give sample of accessing data

or clarify that how you manage rows with days like 1 ot 31 rows.

Regards

Vimlesh

senpradip007
Specialist III
Specialist III

you can use like

makedate(year, month(rowno()), day(rowno())) as Date

Not applicable

Hi,

May be it will match with yur req..

Test:

Load

ID,

Year,

date(Month,'MMM') as NewMonth

from source;

Load *,

rowno() as Key,

rowno() &'-'&NewMonth&'-'&Year as NewDate

resident Test;

rahulsud007
Creator
Creator
Author

Hi guys, I do have multiple Month fields You can consider from Jan to December of last 10 years and need to generate a date field for it. But the things is all these month fields are in different table so I just gave a prototype of only one table. Also for february if it is a leap Year i should get date till 29, 28 n for month with 30 days ie april, june,september, november and rest for 31 days.

Not applicable

Hi Rahul,

Try below script (You can change the values of vDateMin & vDateMax as per your requirement) -

LET vDateMin = Num(MakeDate(2015,1,1)); 

LET vDateMax = Floor(MonthEnd(Today())); 

TempCalendar: 

LOAD

$(vDateMin) + RowNo() - 1 AS DateNumber, 

Date($(vDateMin) + RowNo() - 1) AS TempDate 

AUTOGENERATE 1 

WHILE $(vDateMin)+IterNo()-1<= $(vDateMax);

Calendar: 

LOAD

rowno() AS REC,

Date(TempDate) AS CalendarDate, 

RESIDENT TempCalendar ORDER BY TempDate ASC; 

DROP TABLE TempCalendar; 

Regards,

Nitesh