Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Ask: Partial Sum in Pivot Table to Sum Expression with condition

Hi. I'm qlikview 11 user and I have a problem with my Account Receivable report.

As you can see in the picture below, I want to add a partial sum in Pivot table to OVERPLAFON column which only have a positive value.

piutang.JPG

This is the formula for TOTAL and OVERPLAFON column.

TOTAL = [BLMJDKW] + [BLMJTTEMPO] + [1-14 HARI] + [15-29 HARI] + [>30 HARI] + [UNKNOWN]

OVERPLAFON = [TOTAL] - [PLAFON].

IF I just Sum it all (both positive and negative value in OVERPLAFON column), it'll give a not valid value.

So, that's why I just want to sum a positive value and I'm going to assign 0 to negative value.

I've tried use an condition expression in column OVER, but it doesn't work.

It always gives 0 value in Partial Sum row.

I use this expression in OVER column:

IF ( ((SUM(TOTALRUPIAH)+SUM(RUPIAH))-SUM(NPLAFON)) > 0,

  ((SUM(TOTALRUPIAH)+SUM(RUPIAH))-SUM(NPLAFON)), SUM(0)

)

NOTE: ((SUM(TOTALRUPIAH)+SUM(RUPIAH)) is equal with TOTAL column and SUM(NPLAFON) is equal with PLAFON column.

That's a query column name in my mssql server.

With that expression, I can change negative value and replace it with 0 value but it also gives 0 value in Total.

Anyone can help me?

Hope you guys understand with my poor english ability because I can't speak english well.. hehehe

Thanks

7 Replies
Not applicable
Author


Hi Teddy,

Here i have attached the sample qvw.hope this will satisfy your requirement.

Thanks

Not applicable
Author

Hi Sudha,

Thanks for the help..

if I see from your file, you use straight table.

In my case, I can't get the valid value from partial sum in pivot table. (Pivot table > Properties > Presentation > Show Partial Sums)

For your information, I've tried RangeMax too, but it keep gives me zero value when I use Partial Sums in Pivot table.

Here, I've attached your file again with some additional changes.

Hope you can see that file, and you'll find the point what I meant.

qlikview.JPG

Not applicable
Author

Hi,

PFA the app.

kogasawara
Partner - Creator
Partner - Creator

How about this expression in pivot table?

sum(aggr(if(sum(F1-F2)>0,sum(F1-F2)),F1,F2))

Not applicable
Author

Hi kogasawara and Navdeep Kumar,

Thanks for your help.

@kogasawara : I can't figure out with your expression. I think that expression is not suitable for my case.

@Navdeep Kumar:

qlikview1.JPG

as you can see, your expression works because there's no sum inside if condition. But in my case, i need to have sum expression inside if condition. e.g. : sum( if( sum(F1-F2)>0, sum(F1-F2), 0) )

however, this come out with a result in "error in expression".

This is what i'm facing right now :

=sum(if(F1-F2>0,F1-F2,0))   -> result OK, but i need to have sum inside if condition.

=if(sum(F1-F2)>0,sum(F1-F2),0)) --> it change the negative value to positive but it gives zero in total.

=sum( if( sum(F1-F2)>0, sum(F1-F2), 0) )   --> I need this kind of expression, but qlikview read it as an error. This is what I actually need.


anyone can help?


thanks

Not applicable
Author

Hey,

can u attach your app.

Not applicable
Author

Hi Teddy,

Try this,

=Sum(Aggr(RangeMax(sum(F1-F2), 0), F1, F2))

Thank you @jonathan dienst