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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Derive first day based on month and year

Hello!

I have a table in which I have data for month and year.

Table:Fact_1:

Month   Year   Turnover

10        2019     500

11        2019     1000

 

Now based on the month and year, I want to have first day of the month to be caculated with date type.

Month   Year    Date                               Turnover

10        2019    2019-10-01 00:00:00        500

11        2019    2019-11-01 00:00:00        1000

 

How can I calculate this date in tmap?

 

Regards

PV

Labels (1)
  • v7.x

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I'm not sure if you are asking for the first day (as in 01) or the first day name? I'll show both. The first day name can be calculated as below. I'll assume your data row is "row1" and I'll use your column names....

 

routines.TalendDate.formatDate("EEEE",routines.TalendDate.parseDate("yyyy-MM-dd", row1.Year+"-"+row1.Month+"-01")));

If you want just the date as a numerical String, you don't need to do anything special. Just the below....

 

 

row1.Year+"-"+row1.Month+"-01 00:00:00"

If you want to convert it to an actual Date object, do the following....

 

routines.TalendDate.parseDate("yyyy-MM-dd", row1.Year+"-"+row1.Month+"-01")

 

View solution in original post

2 Replies
Anonymous
Not applicable
Author

I'm not sure if you are asking for the first day (as in 01) or the first day name? I'll show both. The first day name can be calculated as below. I'll assume your data row is "row1" and I'll use your column names....

 

routines.TalendDate.formatDate("EEEE",routines.TalendDate.parseDate("yyyy-MM-dd", row1.Year+"-"+row1.Month+"-01")));

If you want just the date as a numerical String, you don't need to do anything special. Just the below....

 

 

row1.Year+"-"+row1.Month+"-01 00:00:00"

If you want to convert it to an actual Date object, do the following....

 

routines.TalendDate.parseDate("yyyy-MM-dd", row1.Year+"-"+row1.Month+"-01")

 

Anonymous
Not applicable
Author

Hi @rhall 

Thanks for the help! 

 

Regards

PV