Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
djallelsadki
Partner - Creator
Partner - Creator

sub total with if condition, aggr

Hi,

if any one can help

I have a pivot chart with two dimensions, the first one is dim1 = course and the seconde dim2 = student

I want to count the number of student who have a final note <8 AND number of absence <=2

so i used a simple expression that calculate the number of student who have a grade <8 and another one with the number of absences

and create a third one (the one i want) like below :

if([Unauthorized absence]<=2 AND [Grade< 8]=1,Count(DISTINCT STUDENT_KEY))

not working...so i used an aggr function but that still not working

summary :


Dim 1 = course

Dim 2 = student


Expression 1 = [Unauthorized absence]

Expression 2 = [Grade< 8]


Expression 3 = if([Unauthorized absence]<=2 AND [Grade< 8]=1,Count(DISTINCT STUDENT_KEY)) ??

thanks for your help

best regards,

7 Replies
swuehl
MVP
MVP

In general, you need to embed your conditions in the aggregation function:

Use Aggregation Functions!

Try something like

Count(DISTINCT if([Unauthorized absence]<=2 AND [Grade< 8]=1,STUDENT_KEY))

if [Unauthorized absence] AND [Grade< 8] are fields, not expression  labels.

djallelsadki
Partner - Creator
Partner - Creator
Author

Hello,

Thanks, but Unauthorized absence and grade are expressions...

I already used an aggr function, but that still not working without selecting a course value

Best regards,

D.Sadki

flochi75
Creator III
Creator III

Bonjour Dallel,

essaie alors de remplacer [Unauthorized absence] par ton expr1 et [Grade< 8]  par ton exp 2

dans

Count(DISTINCT if([Unauthorized absence]<=2 AND [Grade< 8]=1,STUDENT_KEY))

ce qui ferai

Count(DISTINCT if(expr1<=2 AND expr2<8,STUDENT_KEY))

Florent.

djallelsadki
Partner - Creator
Partner - Creator
Author

Hello,

Merci pour ta réponse mais c'est ce que j'ai déjà, le souci c'est qu'il faut que je sélectionne un cours pour que cela fonctionne, j'ai beau utilisé des Aggr mais ça passe pas

En revanche, en mettant la valeur du cours dans mon set, ça fonctionne...

J'ai testé en ajoutant une fonctionne pick() pour récupérer la valeur de chaque ligne à l’intérieur de mon set, rien à faire...

une idée ?

Merci d'avance,

Cordialement,

alineclozel
Creator
Creator

Bonjour,

Et ça à tout hasard avec un set analysis est ce que ça marche (si les guillements " marchent pas, essauyer avec '):

Count( {<[Unauthorized absence]={"<=2"},[Grade< 8]={"1"}>} STUDENT_KEY)

A +

brunobertels
Master
Master

Bonjour

Essaye çà :

Count({$<[Unauthorized absence]={"<=2"},[Grade< 8]={1}>}STUDENT_KEY)

Bruno

djallelsadki
Partner - Creator
Partner - Creator
Author

Merci pour vos réponses mais ça ne fonctionne pas

Je pense que je vais uploader une partie de mon application

Cordialement,