Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
flochi75
Creator III
Creator III

créer un filtre de trimestres cumulés

Bonjour,

j'aimerai définir en script dans qlikview un champ filtre qui cumule les mois par trimestre, et les trimestres entre eux, càd :

T1= janvier+février+mars

T2=janvier+février+mars+avril +mai+juin

etc...


merci pour votre aide


Florent

1 Solution

Accepted Solutions
cje
Employee
Employee

Bonjour Florent,

Cela répond-t-il à ta demande ?

Cdt

Christophe Jouve

Qlik

Tour Initiale

1 Terrasse Bellini

92919 Paris la Defense

qlik.com<http://www.qlik.com/>

Téléchargez gratuitement QlikView

http://www.qlikview.com/fr/explore/experience/free-download

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

De : Florent Lelarge-Otiniano

Envoyé : mardi 11 septembre 2018 16:13

À : Christophe Jouve <Christophe.Jouve@qlik.com>

Objet : Re: - créer un filtre de trimestres cumulé

View solution in original post

11 Replies
YoussefBelloum
Champion
Champion

Bonjour,

essaye ceci, en plus c'est basé sur un code calendrier

SET v_STARTDATE = '01/01/2016';

LET v_ENDDATE = '31/12/2018';

TMP_DATE_1:

LOAD date(date#('$(v_STARTDATE)','DD/MM/YYYY')-1 + recno() ,'DD/MM/YYYY') as Date

AUTOGENERATE (date#('$(v_ENDDATE)','DD/MM/YYYY') - date#('$(v_STARTDATE)','DD/MM/YYYY')) + 1 ;

TMP_DATE_2:

LOAD

Month(Date) as Month,

'Q ' & ceil(num(Month(Date))/3) as Quarter

RESIDENT TMP_DATE_1

where Month(Date)>=1 and Month(Date)<4;

Concatenate

LOAD

Month(Date) as Month,

'Q ' & 2 as Quarter

RESIDENT TMP_DATE_1

where Month(Date)>=1 and Month(Date)<7;

Concatenate

LOAD

Month(Date) as Month,

'Q ' & 3 as Quarter

RESIDENT TMP_DATE_1

where Month(Date)>=1 and Month(Date)<10;

Concatenate

LOAD

Month(Date) as Month,

'Q ' & 4 as Quarter

RESIDENT TMP_DATE_1

where Month(Date)>=1 and Month(Date)<13;

DROP Table TMP_DATE_1;

résultat:

trimestre_cumul.png

flochi75
Creator III
Creator III
Author

Merci Youssef,

je comprends la logique des 4 passes et de la concaténation, mais dans mon modèle je n'utilise pas de calendrier.

mes données viennent d'un qvd, je l=te le joins.

merci pour ton aide;

Florent

YoussefBelloum
Champion
Champion

essaye ce code (change juste la partie FROM)

QVD:

LOAD @CLE_MODE_LEGAL_HOSPI,

     CODE_DIAG_HOSPI,

     ID_PATIENT_H,

     CLE_TYPE_HAS,

     @CLE_MVT_DIAG,

     ALIMENTATION,

     @CLE_MVT_ISO,

     COMPORTEMENT,

     CONTINENCE,

     DEPLACEMENT,

     HABILLAGE,

     DATE_DEBUT_MVT,

     DATE_FIN_MVT,

     DATE_DEBUT_SEQ,

     DATE_FIN_SEQ,

     Année_Séquence,

     Mois_Séquence,

     Trimestre_Séquence,

     HEURE_DEBUT_SEQ,

     HEURE_FIN_SEQ,

     @CLE_MVT_SEJ,

     NB_ISOL,

     NB_J_D_VENU,

     NB_J_PRES,

     NB_J_VENU,

     NB_PERM,

     NO_SEQUENCE,

     ID_SEQUENCE,

     RELATION,

     DATE_BEBUT_ISO,

     CALC_DATE_BEBUT_ISO,

     DATE_FIN_ISO,

     CALC_DATE_FIN_ISO,

     NO_MESURE,

     CLE_MESURE,

     TYPE,

     CODE_DIAG_HOSPI_CORR,

     TYPE_DIAG_HOSPI,

     Duree_MesureCI,

     LIB_HAS,

     Nb_Années_SuiviH,

     Durées_SuiviH,

     LIB_DIAG_HOSPI,

     TYPE_DIAG_HIER_HOSPI,

     DATE_DEB_ML_HOSPI,

     DATE_FIN_ML_HOSPI,

     LIB_ML_HOSPI,

     Date(Date#(Mois_Séquence,'MMM'),'MM')&' '&Année_Séquence as MOIS_ANNEE_SEQUENCE

FROM

...

(qvd);

SET v_STARTDATE = '01/01/2012';

LET v_ENDDATE = '31/12/2018';

TMP_DATE_1:

LOAD date(date#('$(v_STARTDATE)','DD/MM/YYYY')-1 + recno() ,'MM YYYY') as MOIS_ANNEE_SEQUENCE

AUTOGENERATE (date#('$(v_ENDDATE)','DD/MM/YYYY') - date#('$(v_STARTDATE)','DD/MM/YYYY')) + 1 ;

TMP_DATE_2:

LOAD

MOIS_ANNEE_SEQUENCE,

Month(MOIS_ANNEE_SEQUENCE) as Month,

'Q ' & ceil(num(Month(MOIS_ANNEE_SEQUENCE))/3) as Quarter

RESIDENT TMP_DATE_1

where Month(MOIS_ANNEE_SEQUENCE)>=1 and Month(MOIS_ANNEE_SEQUENCE)<4;

Concatenate

LOAD

MOIS_ANNEE_SEQUENCE,

Month(MOIS_ANNEE_SEQUENCE) as Month,

'Q ' & 2 as Quarter

RESIDENT TMP_DATE_1

where Month(MOIS_ANNEE_SEQUENCE)>=1 and Month(MOIS_ANNEE_SEQUENCE)<7;

Concatenate

LOAD

MOIS_ANNEE_SEQUENCE,

Month(MOIS_ANNEE_SEQUENCE) as Month,

'Q ' & 3 as Quarter

RESIDENT TMP_DATE_1

where Month(MOIS_ANNEE_SEQUENCE)>=1 and Month(MOIS_ANNEE_SEQUENCE)<10;

Concatenate

LOAD

MOIS_ANNEE_SEQUENCE,

Month(MOIS_ANNEE_SEQUENCE) as Month,

'Q ' & 4 as Quarter

RESIDENT TMP_DATE_1

where Month(MOIS_ANNEE_SEQUENCE)>=1 and Month(MOIS_ANNEE_SEQUENCE)<13;

DROP Table TMP_DATE_1;

cje
Employee
Employee

Bonjour Florent,

Cela répond-t-il à ta demande ?

Cdt

Christophe Jouve

Qlik

Tour Initiale

1 Terrasse Bellini

92919 Paris la Defense

qlik.com<http://www.qlik.com/>

Téléchargez gratuitement QlikView

http://www.qlikview.com/fr/explore/experience/free-download

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

De : Florent Lelarge-Otiniano

Envoyé : mardi 11 septembre 2018 16:13

À : Christophe Jouve <Christophe.Jouve@qlik.com>

Objet : Re: - créer un filtre de trimestres cumulé

flochi75
Creator III
Creator III
Author

Bonjour Youssef,

j'ai copié collé ton script,

peu importe le Quarter choisi, le seul mois possible est avril...

Florent

flochi75
Creator III
Creator III
Author

Capture.JPG

YoussefBelloum
Champion
Champion

je vois.

le mois que tu doit utiliser est désormais le champ "Month"..

flochi75
Creator III
Creator III
Author

dans ce cas, ça reste janvier :

Capture.JPG

YoussefBelloum
Champion
Champion

ci-joint un QVW de test