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: 
Not applicable

Selecting one field from two tables separately

Hello

I've got table with date formatted like this:

date2.PNG

It's YYYYWW (year - week)

And i did these two tables using mid(date, 1, 4) and mid(date, 5)

I also tried doing date: =Year(MakeWeekDate(mid(date, 1, 4), mid(date, 5), 1)), but it doesn't work.

date1.PNG

And when i select week, I can't select year at the same time.

When week is selected and i select year, week de-selects and only year is selected.

Have you got any idea how to do this?

1 Solution

Accepted Solutions
Ralf-Narfeldt
Employee
Employee

I don't know exactly what you have done, but this should work.

dates:

LOAD * INLINE [

    date

    201420

    201421

    201422

    201423

    201424

    201425

];

realdates:

Load *, Year(realdate) as Year, Week(realdate) as Week;

Load

MakeWeekDate(mid(date, 1, 4), mid(date, 5), 1) as realdate

resident dates;

Drop table dates;

Rename Field realdate to date;

View solution in original post

3 Replies
martinpohl
Partner - Master
Partner - Master

Please post your data model (from table viewer), it might seems that there is a wrong link between the datas.

Regards

jonathandienst
Partner - Champion III
Partner - Champion III

By two tables, I assume you mean you made the two list boxes using the expressions.

When you use an expression in a list box, and you make selections, you are actually making a selection on the underlying field(s). Both these list boxes use the same underlying field, so your selection in the other box conflicts with the first selection.

You would be better off creating Year and Week fields in your load script and using these two fields, rather than the expressions.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Ralf-Narfeldt
Employee
Employee

I don't know exactly what you have done, but this should work.

dates:

LOAD * INLINE [

    date

    201420

    201421

    201422

    201423

    201424

    201425

];

realdates:

Load *, Year(realdate) as Year, Week(realdate) as Week;

Load

MakeWeekDate(mid(date, 1, 4), mid(date, 5), 1) as realdate

resident dates;

Drop table dates;

Rename Field realdate to date;