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

Fonction peek ?

Bonjour tout le monde !

Je bloque sur une requête concernant les arrêts de travail :

Voici a quoi ressemble le résultat de ma requête,

ABSDEF           ABSDRET      ABSNBJ

05/02/2015        06/02/2015            1

15/06/2015        02/07/2015           17

02/07/2015        12/07/2015           10

12/07/2015        23/07/2015           11

23/07/2015        15/09/2015           54

15/09/2015        21/09/2015            6

Pour un agent cela me donne ce résultat, je souhaiterai identifier le nombre d'arrêt de travail par agents sur une années.

Mon soucis pour le moment c'est que la, qlikview me ressort une ligne même pour les prolongations d'arrêt qui font pour moi partie de l'arrêt initial.

Il faudrait que j'arrive a regrouper les prolongations avec l'arrêt initial.

Dans l'exemple que je vous ai donné ci dessus on peut voir qu'il y a un arrêt en février

Puis il y a un deuxième arrêt a partir du 15/06/2015 jusqu'au 02/07/2015, cet arrêt ce prolonge jusqu'au 21/09/2015.

Je voudrai donc obtenir que deux lignes et je maitrise pas trop la fonction peek !

Je voudrai ensuite avoir un champ arrêt initial et un autre prolongation comment est ce que je peux procéder ?

Merci par avance pour votre aide

Bien cordialement

Romaric CANTIN

10 Replies
cje
Employee
Employee

Bonjour,

En supposant que les données sont triées par AGENT et DATES, voici un exemple de code résolvant votre problème. Il permet de positionner un flag permettant de savoir si l’enregistrement correspond à une prolongation ou un état initial.

J’ai créé un champ AGENT en plus et un champ PROLONGATION qui contient le flag. 1=PROLONGATION, 0 = ARRET INITIAL.

arrets:

load *, if (previous(ABSDRET)=ABSDEF AND previous(AGENT)=AGENT,1,0) as PROLONGATION;

load * inline

[AGENT,ABSDEF,ABSDRET,ABSNBJ

A1,05/02/2015,06/02/2015,1

A2,15/06/2015,02/07/2015,17

A2,02/07/2015,12/07/2015,10

A2,12/07/2015,23/07/2015,11

A2,23/07/2015,15/09/2015,54

A2,15/09/2015,21/09/2015,6

A3,01/01/2015,10/01/2015,9

];

Au final, on obtient cela :

AGENT

ABSDEF

ABSDRET

ABSNBJ

PROLONGATION

A1

05/02/2015

06/02/2015

1

0

A2

15/06/2015

02/07/2015

17

0

A2

02/07/2015

12/07/2015

10

1

A2

12/07/2015

23/07/2015

11

1

A2

23/07/2015

15/09/2015

54

1

A2

15/09/2015

21/09/2015

6

1

A3

01/01/2015

10/01/2015

9

0

Ensuite, baser vos calculs sur la valeur du flag PROLONGATION.

Cdt

Christophe Jouve

Principal Solution Architect

Direct: +33 1 55 62 65 54

Mobile: +33 6 76 24 22 47

Email: Christophe.Jouve@qlik.com

Qlik

France Headquarters Office,93 avenue Charles de Gaulle

92200 Neuilly sur Seine

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

Téléchargez gratuitement QlikView

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

<http://www.qlik.com/us/explore/products/sense?SourceID1=Corporate_Email_Signature>

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.

cje
Employee
Employee

Oups,

Petit pb de rendu de la table. En voici l’image.

Cdt

Christophe Jouve

Principal Solution Architect

Direct: +33 1 55 62 65 54

Mobile: +33 6 76 24 22 47

Email: Christophe.Jouve@qlik.com

Qlik

France Headquarters Office,93 avenue Charles de Gaulle

92200 Neuilly sur Seine

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

Téléchargez gratuitement QlikView

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

<http://www.qlik.com/us/explore/products/sense?SourceID1=Corporate_Email_Signature>

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.

Not applicable
Author

Créer un champs AGENT est-il nécessaire moi j'ai déjà les détails agents dans ma table.

NOM pour le nom de l'agent

Prénom pour le prénom de l'agent notamment.

Merci pour votre aide

Cordialement

Romaric

Not applicable
Author

arrets:
load *, if (previous(ABSDRET)=ABSDEF,1,0) as PROLONGATION;
//AND previous(NOM)=NOM,1,0) as PROLONGATION;
load * inline
[ABSDEF,ABSDRET,ABSNBJ
05/02/2015,06/02/2015,1
15/06/2015,02/07/2015,17
02/07/2015,12/07/2015,10
12/07/2015,23/07/2015,11
23/07/2015,15/09/2015,54
15/09/2015,21/09/2015,6
01/01/2015,10/01/2015,9
];

Avec ceci j'ai le résultat souhaité.

Un grand très grand merci à toi Christophe

Bonne fin de journée

Bien cordialement

Romaric

cje
Employee
Employee

Non, j’en ai créé un pour les besoins de l’exemple.

Cdt

Christophe Jouve

Principal Solution Architect

Direct: +33 1 55 62 65 54

Mobile: +33 6 76 24 22 47

Email: Christophe.Jouve@qlik.com

Qlik

France Headquarters Office,93 avenue Charles de Gaulle

92200 Neuilly sur Seine

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

Téléchargez gratuitement QlikView

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

<http://www.qlik.com/us/explore/products/sense?SourceID1=Corporate_Email_Signature>

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.

Not applicable
Author

Une dernière petite question cependant,

Comment est ce que je dois faire pour ne pas ressaisir à chaque fois dans mon script les dates.

Je voudrai juste sélectionner mon nom agent, et la période que je retrouve dans ma table pour que à partir de la qlik view me sorte les arrêts avec les dates automatiquement.

Je ne veux pas saisir les dates d'arrêt agent par agent dans le script.

Merci !

Cordialement

Romaric

cje
Employee
Employee

Re,

La sélection des agents et dates associées se fait automatiquement dans l’interface par associativité.

Il vous suffit de créer des listes sur les noms des agents et le cas échéant, une période d’analyse (année, mois par exemple).

Vous n’avez pas à gérer cela dans le script.

Le script est dédié uniquement au chargement initial des données dans QlikView avec certains calculs intermédiaires si besoin, comme celui évoqué dans notre échange. Par défaut, vous allez charger toutes les données pour tous les agents (d’où l’intérêt de la colonne NOM de l’agent).

Ou alors je n’ai pas saisi votre question…

Cdt

Christophe Jouve

Principal Solution Architect

Direct: +33 1 55 62 65 54

Mobile: +33 6 76 24 22 47

Email: Christophe.Jouve@qlik.com

Qlik

France Headquarters Office,93 avenue Charles de Gaulle

92200 Neuilly sur Seine

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

Téléchargez gratuitement QlikView

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

<http://www.qlik.com/us/explore/products/sense?SourceID1=Corporate_Email_Signature>

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.

alineclozel
Creator
Creator

Je suis absent(e) du bureau jusqu'au 31/08/2015

Je répondrai à votre message dès mon retour.

Mail PLH : plh@agglo-grandavignon.fr

pour toute autre demande : contact@agglo-grandavignon.fr

Remarque : ceci est une réponse automatique à votre message "Reply marked

as helpful on Fonction peek ?" envoyé le 26/08/2015 10:31:19.

C'est la seule notification que vous recevrez pendant l'absence de cette

personne.

Not applicable
Author

Bonjour,

Si j'ai bien compris :

Le LOAD * INLINE est juste là pour donner un jeu de donnée à manipuler pour l'exemple. Vous devez le remplacer par un LOAD et/ou un SQL SELECT qui travaille sur vos tables.

Cordialement,

Xavier.