Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
New 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
Highlighted

Re: sum problem with pivot table

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
Highlighted

Re: sum problem with pivot table

What is the expression that you are using?

Highlighted
New Contributor II

Re: sum problem with pivot table

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)

Highlighted

Re: sum problem with pivot table

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

Highlighted
New Contributor II

Re: sum problem with pivot table

excellent bro. thanks a lot

Highlighted
Esteemed Contributor III

Re: sum problem with pivot table

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))

Highlighted

Re: sum problem with pivot table

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))

Highlighted
Esteemed Contributor III

Re: sum problem with pivot table

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))

Highlighted
Esteemed Contributor III

Re: sum problem with pivot table

Oh i missed that. Got it. Thank you.