Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Wrong partial sums

Hello

I created a qvw and on the expressions I have multiple IF statements in order to calculate the data  as shown on the attached picture.

The problem is that when I ask for partial Sums on pivot table or totals on straight table, the totals are wrong.

What I am loosing?


expression eg. :

IF((PLAN_START_YEAR_MONTH-YEAR_MONTH)=0,sum(PLResult_EndFishNo),

IF((Sum(PLResult_EndFishNo)=0),sum(COSTMAIN_EndFishNo),(Sum(PLResult_EndFishNo)))).

The first IF statement is applied on the 8th month .

Screenshot_6.png



1 Solution

Accepted Solutions
Not applicable
Author

This is the correct syntax.

SUM(AGGR((IF((PLAN_START_YEAR_MONTH-YEAR_MONTH)<=0,SUM(PLResult_EndFishNo),

IF((PLAN_START_YEAR_MONTH-YEAR_MONTH)>0,SUM(COSTMAIN_EndFishNo)))),THEYEAR,THEMONTH))

View solution in original post

5 Replies
Not applicable
Author

This is the correct syntax.

SUM(AGGR((IF((PLAN_START_YEAR_MONTH-YEAR_MONTH)<=0,SUM(PLResult_EndFishNo),

IF((PLAN_START_YEAR_MONTH-YEAR_MONTH)>0,SUM(COSTMAIN_EndFishNo)))),THEYEAR,THEMONTH))

Gysbert_Wassenaar

Try this: sum(aggr( ...original expression here ... , YEAR, MONTH))


talk is cheap, supply exceeds demand
nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

in stright table ,

Goto expression table and select Sum o Row,

I guess u ll get solution

If not try to share sample data to get better solution

ST Total.PNG

-Nagarjun

sunny_talwar

Try wraping it with Sum(Aggr(...., YEAR, MONTH))

Sum(Aggr(

IF((PLAN_START_YEAR_MONTH-YEAR_MONTH)=0,sum(PLResult_EndFishNo),

IF((Sum(PLResult_EndFishNo)=0),sum(COSTMAIN_EndFishNo),(Sum(PLResult_EndFishNo))))

, YEAR, MONTH))

Not applicable
Author

I tried this from the beginning.It is wrong due to different fields that must be aggregated.