Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aminehaddar
Contributor II
Contributor II

aggr() how to use it

Hello,

I have this table :

ID_EMPEmploi PRODUIT_ID DUREE PRODUITS_REALISATION_NBRREALISATION_VOLUMECOEF_NBCOEF_VOLSCORE_NBSCORE_VOL
0101EMPLOI01x18P1 SUP81,011500,03030 30345,0
x28P1 SUP81,0700,0150 150,0
x38P1 SUP81,010200,03030 30306,0
x48P1 SUP81,00,0150 150,0
x48P1 SUP81,0100,0150 150,0
x58P1 SUP81,010000,01510 15100,0
x64P1 INF81,010000,01510 15100,0
-- - - - -

PRODUITS_ is calculated using DUREE,

REALISATION_NBR is sum(VALUE) when PRODUIT_REF='100'

REALISATION_VOL is sum(VALUE) when PRODUIT_REF='200'

COEF_NB is calculated using PRODUITS_ and REALISATION_VOL

COEF_VOL is calculated using PRODUITS_ and REALISATION_VOL ( same as the previous one but with other coef )

SCORE_NB is calculated using COEF_NB x REALISATION_NBR

SCORE_VOL is calculated using COEF_VOL x REALISATION_VOL


My question, why my total is not calculated even when I checked in the window='PRESENTATION' the ID_EMP.

How to use the Aggr() if it is the solution here.


Regards


2 Replies
swuehl
MVP
MVP

I assume you are using the conditional outside the aggregation function, you should include it in the aggregation:

Use Aggregation Functions!

rubenmarin

Hi Amine, I'm not sure you'll need aggr(), maybe for some expression but not for all, here is a video that explains aggr()

Qlik Sense in 60 - The Aggr() function - YouTube

To get a solution answer is better is you upload a sample, so we can play with it and return with the expected result for the sample data.

Or at least you'll need to tell with expressions are you using and how are the total configured.

Note that if you are just using a field, without any aggregation function (Sum, Avg...), when QV has many different it returns Null(), because it doesn't know what operations has to do with all that different values.