Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

'Bug' in Straight Table & Pivot Table Subtotal & Total

Hi

I encountered below 'bug' when trying to develop some reports for my client.

Straight Table & Pivot Table subtotal & total are wrong (circled in red). They are based upon 'expression' instead of 'sum of total' which cannot be controlled by us :

test.png


Please help. I also attach the qvw file for easy reference.



Thanks,

Eric


1 Solution

Accepted Solutions
Gysbert_Wassenaar

It's not a bug. You're using an expression that's not a pure sum that be totaled as-is at every level. The expressions is also evaluated at the total levels and the result there is not the same as the sum of the results at the detailed level because of your if statement. What you want is the sum of an aggregation expression: sum( aggr( ...your_expression...), Type, Date, Description)): sum(aggr( if(Profit<0,0,Profit*.3) ,Type,Date,Description))


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

It's not a bug. You're using an expression that's not a pure sum that be totaled as-is at every level. The expressions is also evaluated at the total levels and the result there is not the same as the sum of the results at the detailed level because of your if statement. What you want is the sum of an aggregation expression: sum( aggr( ...your_expression...), Type, Date, Description)): sum(aggr( if(Profit<0,0,Profit*.3) ,Type,Date,Description))


talk is cheap, supply exceeds demand
qlikview979
Specialist
Specialist

Hi,

Please find the attached file

Regards,

Mahesh

Anonymous
Not applicable
Author

Thanks Wassenaar! It works now.

Regards,

Eric

Anonymous
Not applicable
Author

Thanks Mahesh for your reply! By the way, I only have personal version so cannot open your file.

kamal_sanguri
Specialist
Specialist

Hi,

This might be easy to understand..

use this expression to calculate your tax:

=sum(if(Profit>0,Profit* .3))

The problem with your expression is it is taking sum of all the items although you are replacing them with '0' .

-Kamal