Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Mlan
Contributor
Contributor

Connect Weeks to year

Hi, 

 

I have created a date field out of a dimension. My data is written in the following way: 1950, 1951, 1952, 2001, 2002... 

Were the two first numbers 19 or 20 represent the years 2019 or 2020 and the second two numbers represent weeks. I did the following:

LOAD
MakeWeekDate(Year, Week, 0) as Date, //0= monday
*
;
LOAD
Year(Date#(LEFT(YearWeek,2), 'YY')) as Year,
RIGHT(YearWeek,2) as Week
inline [
YearWeek

1950,

1951,

1952,

2001,

2002,
];

 

Now to my problem, when I select date field, Weeks in a bar chart and then filter on for example the year 20 nothing happens, The chart still shows week 50, 51, 52. It's like the weeks is not connected to the year. 

Does anyone know how I can solve this issue`? 

thanks in advance, 

Labels (2)
2 Replies
dplr-rn
Partner - Master III
Partner - Master III

the actual scipt looks fine.

Whats the expression in the chart?

Mlan
Contributor
Contributor
Author

the expression is: 

Sum({< [Date] = {"=WeekName([Date])>WeekName(Now(),-2,0)-7*10 AND WeekName([Date])<=WeekName(Now(),-2,0)"}>} HpT_W)

I did this expression since I wanted to show the 10 latest weeks starting from 2 weeks ago. 

HpT is hours in this case. 

Thank you