Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sunil-kumar5
Creator II
Creator II

Not getting years and month

Hi Community,

In my scrip I am using below method to create year and month for my table but now sure as why I am getting blank in years and month column while checking in data modeling.

Created_Date,
YEAR(Created_Date) as TYear,
MONTH(Created_Date) as TMonth,

Is there any idea? I did apply the same way before it worked always but not for now.

18 Replies
tm_burgers
Creator III
Creator III

 

Try

YEAR(date(Created_Date)) as TYear,
MONTH(date(Created_Date)) as TMonth

 

 

If that doesn't work you may need to use date#() to define the format of your date field. 

Vegar
MVP
MVP

Maybe your created_date content have changed?

What happens if you do

Num(created_date) as numdate, 

Dayname(created_date) as Dayname

 

miguelbraga
Partner - Specialist III
Partner - Specialist III

Hey there,

This can happen for many reasons such as:

  • Environment Variables not matching with your data ence the problem of not resolving the Year
  • Data inconsistency in the Created_Date field caused by multiple types of writing the date field
  • If changes were applied in the time and region on the OS it may cause this error

A workarround simple is to make the Created_Date in number value and then in date, only after that you can invoke the Year and Month functions. Try this:

Created_Date,
YEAR(date(num(Created_Date))) as TYear,
MONTH(date(num(Created_Date))) as TMonth,

Let me know if it worked.

Best regards,

MB

Kushal_Chawda

seems like some text values are encountered in your Date field.  Can you take that date field in filter pan and see if any left aligned values?

sunil-kumar5
Creator II
Creator II
Author

Hi,

No success , Is there any other way around?

sunil-kumar5
Creator II
Creator II
Author

Hi,

Its not working , getting an error msg not found created date

sunil-kumar5
Creator II
Creator II
Author

Hi,

I tries this but no luck , is there any other way?

sunil-kumar5
Creator II
Creator II
Author

Hi Kush,

In a filter pane I put created date and hit done editing. When I clicked on filter all the dates are coming on left side (Just to clear my left side :-))

sunil-kumar5
Creator II
Creator II
Author

Hi Everyone,

Any suggestion on this please?

Thanks