Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
chadliagabsi
Creator II
Creator II

Présence n et n-1

Bonjour,

je veux calculer mois n et n-1 pour chaque agent j'ai utilisé l'expression suivante pour annee et mois n et ça fonctionne 

if(MOTIF<>'Congé parental' and sum(((aggr(count(DATE_DEB_FIN),ANNEE,MOIS, MOTIF,TEMPS_TRAVAIL)/30)*TEMPS_TRAVAIL)/100)/12<>0,1,0)


par contre pour n-1 j'ai utilisé cette expression qui me retourne toujours 0.

if(MOTIF<>'Congé parental' and aggr(sum ({$<ANNEE={$(=max(ANNEE-1))}>}(count(DATE_DEB_FIN)/30)*TEMPS_TRAVAIL),ANNEE,MOIS),1,0)

11 Replies
sunny_talwar

Can you try this

If(Sum({$<ANNEE = {$(=max(ANNEE)-1)}, MOTIF = {'*'}-{'Congé parental'}>} ((Aggr(Count({$<ANNEE = {$(=max(ANNEE)-1)}, MOTIF = {'*'}-{'Congé parental'}>} DATE_DEB_FIN), ANNEE, MOIS, MOTIF, TEMPS_TRAVAIL)/30) * TEMPS_TRAVAIL)/100)/12 <> 0, 1, 0)

chadliagabsi
Creator II
Creator II
Author

For all years it return a zigzag of 0,1

1. Result

test.png

2. But with the following expression i have the correct result for the last year (2017,2018) If i selected other year i have 0 in n-1.

Expression

if(sum(((aggr(count({$<ANNEE={$(=max(ANNEE)-1)}, MOTIF={'*'}-{'Congé parental'}>}DATE_DEB_FIN),ANNEE,MOIS, MOTIF,TEMPS_TRAVAIL)/30)*TEMPS_TRAVAIL)/100)/12<>0,1,0)

Result

test.png

Thanks.