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: 
ivan_revuelta
Contributor
Contributor

Problem to filter two intervals of different dates with the same filter Year

Hello,

 

I'm a rookie at Qlik and I need help. Looking in the forum I have managed to load a script that allows me to see the courses that are active between two dates through the Year filter: (This part does it well)

 

 

Example.PNG

The problem is that I need to filter also by the group in which the teachers were at that moment. That is, in addition to filter by Start date (Fecha inicio) and End date (Fecha fin), I also need to do so by the fields memberStartDate(miembroDesde) and memberEndDate(miembroHasta). I do not know how to do it...

 

This is my script:

 

[cursos]:

LOAD

    codigoCurso,

    curso,

    Date(Date#([fechaInicio], 'DD/MM/YYYY') ) AS [fechaInicio],

Date(Date#([fechaFin], 'DD/MM/YYYY') ) AS [fechaFin],

    profesor

FROM [lib://AttachedFiles/Cursos.csv]

 

(txt, codepage is 28591, embedded labels, delimiter is ';', msq);

 

[profesores]:

LOAD

    profesor,

    Grupo,

    Date(Date#([miembroDesde], 'DD/MM/YYYY') ) AS [miembroDesde],

Date(Date#([miembroHasta], 'DD/MM/YYYY') ) AS [miembroHasta]

FROM [lib://AttachedFiles/profesores.csv]

(txt, codepage is 28591, embedded labels, delimiter is ';', msq);

 

MinMaxDate:

Load

  RangeMin(Min(fechaInicio),Min(fechaFin)) as MinDate,

  RangeMax(Max(fechaInicio),Max(fechaFin)) as MaxDate

Resident cursos;

 

Let vMinDate = Num(Peek('MinDate',0,'MinMaxDate'));

Let vMaxDate = Num(Peek('MaxDate',0,'MinMaxDate'));

 

Drop Table MinMaxDate;

 

Calendar:

Load

  Date(TempDate) as Date,

  Month(TempDate) as Month,

  Year(TempDate) as Year,

  Date(MonthStart(TempDate),'DD/MM/YYYY') as MonthYear;

Load

  $(vMinDate)+IterNo()-1 as TempDate

AutoGenerate 1

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

 

IntervalMatch(Date)

Load fechaInicio, fechaFin Resident cursos;

 

2 Replies
dplr-rn
Partner - Master III
Partner - Master III

Hi Ivan

i believe you will need to use set analysis on your table

something like miembroDesde ={"<=$(Max(Date))"}, miembroHasta={"<=$(Max(Date))"}

 

if you can share a sample app i can help further

 

ivan_revuelta
Contributor
Contributor
Author

Hi, 

I just uploaded a sample app. 

Many thanks