Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
pamaxeed
Partner - Creator III
Partner - Creator III

Set Analysis - Date Expression

Hi,

i am struggling with dates problem.

I have the following tables as datasource:

Table1:

PartnerNo

NameLastNameFromTo
1HansHouse01.01.201131.01.2012
1HansHouse01.02.201131.02.2012
Table2:
PartnerNoCountryDomizilFromTo
1CHCH01.01.201110.01.2011
1CHFR10.01.201115.01.2011
1CHI15.01.201125.01.2011
1CHDE25.01.201103.02.2011

The two tables are connected with the PartnerNo only in my datamodel in qlikview.

I build a Calendar and i am using the interval function two allow selection between date range.

Snippet of script:

DateLink:

Load  PartnerNo,

     From,

     To

Resident Table1;

Load PartnerNo,

     From,

     To

Resident Table2;

and using then the interval function to allow date (day, month, year) selection.

The problem i encounter now is that when i make a month selection, in this case january i want that my chart looks like that:

NameLastNameCountryDomizil
HansHouseCHDE

This means i want to have the Name and LastName from Table 1 and the max(date) from the selected month.

How i can achieve this?

Best regads,

Patric

6 Replies
Not applicable

Hi Patric

Domizil holds the domizil according to the last date so

only(aggr(only(domizil), max(date)))   to get the last domizil  should work

you could also use a rowno() function to get an order number if you load with order by "From"  and take the max(n)

best regards

Chris

pamaxeed
Partner - Creator III
Partner - Creator III
Author

Thank you for the answer, i will have n dimension in the table not only domizil, in that case?

Not applicable

Doesn't matter how many dimensions you have

You need to know the fields you want as reference to assign Domizil  (if only Date allows you to assign Domizil you aggr on max(date))

Chris

Anonymous
Not applicable

Hi,

Try with these expressions,

Only({<From={"=$(Date(max(From),'DD.MM.YYYY'))"}>}Name)

Only({<From={"=$(Date(max(From),'DD.MM.YYYY'))"}>}LastName)

Only({<From={"=$(Date(max(From),'DD.MM.YYYY'))"}>}Country)

Only({<From={"=$(Date(max(From),'DD.MM.YYYY'))"}>}Domizil)

pamaxeed
Partner - Creator III
Partner - Creator III
Author

Hi again,

i tried to get rid with the date problems, but hmmm....

The problem of this 2 tables is that the time measure is different.for the same partner.

The first table have a monthly "FROM" - "TO"  (ex: 01.01.2010-31.01.2010), the second table can have different periods in the same month, like:
- 01.01.2010 - 10.01.2010
- 10.01.2010 - 17.01.2010
- 17.01.2010 - 25.01.2010
- 25.01.2010 - 02.02.2010

When i have a selection scenario where i select the month january 2010, the result should be the data of the table 1 from month january and the Max(From) from the table 2, in  the same row (like a JOIN):

NameLastNameCountryDomizil
HansHouseCHDE

Attached my demo application.

Thanks for ur help i am struggling the whole day to find a solution.

Best regards,

Patric

pamaxeed
Partner - Creator III
Partner - Creator III
Author

The only way i found to solve it is to make a cartesian product between Table1 and Table2 taken as only joining field the PartnerNO and taking as reference dates the monthly one in my interval function.

The expression in the chart is very simply, is there a way to build it via Set Analysis?


if(To >= Valid_from AND To <= Valid_to, only(Domizil)) ?

Attached the sample.

Thanks!

Every day is a new challenge