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

Subtotals/Totals not working as expected

Hi,

I have an expression ---=Sum({$<Date={"<=$(vInputDate)"},CLEAR_DATE={0,">$(vInputDate)"}>} Value_$(vAB)) 

I want to use this and create two columns in my straight table one with positive values and the other with negative.

I also want to create two pivot tables with these columns.

 

1. For positive column

-Straight Table: The rows are working as expected but the totals are also including the neg value.

-Pivot Table: The Total again in incorrect and is including the negative values. The dimension for which the overall result is negative is not showing subtotals. 

2. For Neg column

-Straight table: Total shows zero.

-Pivot Table: No total. The subtotal is only being shown for the dimension that aggregates to negative.

===================

Here is a sample version of type of data and the qlik straight tables n pivot tables I am getting.

AB108_0-1661207900441.png

 

Expressions I use for two columns:

Positive:

If(Sum({$<Date={"<=$(vInputDate)"},CLEAR_DATE={0,">$(vInputDate)"}>} Value_$(vAB))>0,

Sum({$<Date={"<=$(vInputDate)"},CLEAR_DATE={0,">$(vInputDate)"}>} Value_$(vAB)),0)

Negative:

If(Sum({$<Date={"<=$(vInputDate)"},CLEAR_DATE={0,">$(vInputDate)"}>} Value_$(vAB))<0,

Sum({$<Date={"<=$(vInputDate)"},CLEAR_DATE={0,">$(vInputDate)"}>} Value_$(vAB)),0)

 

 

Labels (2)
2 Replies
RaviPuttaswamy5
Partner - Contributor III
Partner - Contributor III

For Pivot, use the aggr function with dimensions used in table, so both straight table and Pivot table values get match.

Eg, Aggr(sum(ABC),Dim1,Dim1..)

AB108
Contributor III
Contributor III
Author

Hi,

The straight table and pivot table are matching in all the values even now.

The main issue is with the subtotals and totals. If you can check the screenshot I have shared, the subtotals/totals are not summing the rows as is but taking all the values(positive/negative)