Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
aminehaddar
Contributor II
Contributor II

sum problem with pivot table

Hello,

I have this table:

COMMERCIAL Emploi PRODUITS REALISATIONscoreSCORE_AVEC_PLAFOND
001CCPPx1331568663141667
x284576422881667
416144 66314 66314
002CCPPx24752950950
x32605791302891667
265331 950 950

I have a problem with the sum here.

Can you explain why I got this mistake?

and anyone that can help me to resolve this issue please?

Thanks

Regards,

1 Solution

Accepted Solutions
sunny_talwar

May be try this

score=

Sum(Aggr(

if(

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

<0,

0,

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

)

, COMMERCIAL, Emploi, PRODUITS))

SCORE_AVEC_PLAFOND=

Sum(Aggr(

if(match(REF,'19.1','377')   and  

Sum(Aggr(

if(

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

<0,

0,

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

)

, COMMERCIAL, Emploi, PRODUITS))

>2000*(5/6),  2000*(5/6),  

Sum(Aggr(

if(

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

<0,

0,

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

)

, COMMERCIAL, Emploi, PRODUITS))

)

, COMMERCIAL, Emploi, PRODUITS))

View solution in original post

8 Replies
sunny_talwar

What is the expression that you are using?

aminehaddar
Contributor II
Contributor II
Author

REALISATION= sum(VALEUR)

score=

if(

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

<0,

0,

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

)

SCORE_AVEC_PLAFOND=

if(match(REF,'19.1','377')   and   score>2000*(5/6),  2000*(5/6),   score)

sunny_talwar

May be try this

score=

Sum(Aggr(

if(

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

<0,

0,

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

)

, COMMERCIAL, Emploi, PRODUITS))

SCORE_AVEC_PLAFOND=

Sum(Aggr(

if(match(REF,'19.1','377')   and  

Sum(Aggr(

if(

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

<0,

0,

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

)

, COMMERCIAL, Emploi, PRODUITS))

>2000*(5/6),  2000*(5/6),  

Sum(Aggr(

if(

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

<0,

0,

if(IsNull(score_periode1), sum(score_periode2*VALEUR),sum(score_periode1*VALEUR))

)

, COMMERCIAL, Emploi, PRODUITS))

)

, COMMERCIAL, Emploi, PRODUITS))

aminehaddar
Contributor II
Contributor II
Author

excellent bro. thanks a lot

vishsaggi
Champion III
Champion III

Can we write this way sunny?

score=

Sum(Alt(score_periode1, scoreperiode2)*VALEUR)

SCORE_AVEC_PLAFOND=

if(match(REF,'19.1','377')   and   Sum(Alt(score_periode1, scoreperiode2)*VALEUR)  > 2000*(5/6),  2000*(5/6),   Sum(Alt(score_periode1, scoreperiode2)*VALEUR))

sunny_talwar

I think there is a check for less than 0 also... may be like this

Sum(Aggr(RangeMax(Sum(Alt(score_periode1, scoreperiode2)*VALEUR), 0), COMMERCIAL, Emploi, PRODUITS))

vishsaggi
Champion III
Champion III

Hey Amine,

can you also try this and let us know if this works too?

score=

Sum(Aggr(RangeMax(Sum(Alt(score_periode1, scoreperiode2)*VALEUR), 0), COMMERCIAL, Emploi, PRODUITS))

SCORE_AVEC_PLAFOND=

Sum(Aggr(

if(match(REF,'19.1','377')   and

Sum(Aggr(RangeMax(Sum(Alt(score_periode1, scoreperiode2)*VALEUR), 0), COMMERCIAL, Emploi, PRODUITS)) > 2000*(5/6),  2000*(5/6),

Sum(Aggr(RangeMax(Sum(Alt(score_periode1, scoreperiode2)*VALEUR), 0), COMMERCIAL, Emploi, PRODUITS))

)

, COMMERCIAL, Emploi, PRODUITS))

vishsaggi
Champion III
Champion III

Oh i missed that. Got it. Thank you.