Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date format to year

Hi,

I am using a flat file that has the date format MM-DD-YYYY but I only need to sum the values for the current year. Do I need to create a new flat file with a different column in excel strictly for the year or am I able to use a function that filters out 2017?

Thank you!

4 Replies
sunny_talwar

You can use Year() function to create a new field in the script

Year(DateField) as Year

As long as date is read as date (and not string) by qlikview you should be fine. In case QlikView doesn't read it as date, you can try this

Year(Date#(DateField, 'MM-DD-YYYY')) as Year

its_anandrjs

Why not you are using master calendar with all date fields on them.

Calendar:

LOAD

Year(Date( $(vMinDate) + IterNo() - 1 ))    as [Year Field],

Week(Date( $(vMinDate) + IterNo() - 1 ))    as [Week Field],

WeekDay(Date( $(vMinDate) + IterNo() - 1 )) as [WeekDay Field],

WeekEnd(Date( $(vMinDate) + IterNo() - 1 )) as [WeekEnd Field],

//Today() as TodayDate,

Num( $(vMinDate) + IterNo() - 1 ) as TDate

AutoGenerate 1

While ($(vMinDate) + IterNo() - 1) <= $(vMaxDate);

Anonymous
Not applicable
Author

It recognizes it as a date because there is a value in the table. I do not know how to just have data show from 1/1/2017 - today (year to date) in the expression.

sunny_talwar

May be like this in your expression's set analysis

{<DateField = {"$(='>=' & Date(YearStart(Today()), 'MM-DD-YYYY') & '<=' & Date(Today(), 'MM-DD-YYYY'))"}>}