Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

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
Highlighted

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

Highlighted

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);

Highlighted
Contributor II
Contributor II

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.

Highlighted

May be like this in your expression's set analysis

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