Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subtotals not dispalyed, when Only function is used in pivot table

Hi Experts,

I have scenario where I would like to compare the sale of a particular product with all Products of the category - I use the following expression

=Sum(AGGR (NODISTINCT SUM({ <QUARTER_YEAR = {">=$(vFiscalStart)<=$(vFiscalEnd)"}, [PRODUCT_CATEGORY]=, PRODUCT=> }  SALES), [PRODUCT_CATEGORY]))

This fetches me the expected results when no Product / Product Category is selected. However, When I select a Product / Product Category, I am seeing the correct numbers only for the selected Product / Product Category. In order to ensure, that my results are not changed, when there is a selection happening in either of Product or Product Category, i used the below expression,


only({1}AGGR(NODISTINCT SUM({<MONTH_YEAR = {">=$(vTimeStart)<=$(vTimeEnd)"}, PRODUCT_CATEGORY=, PRODUCT=> }SALEAMOUNT), PRODUCT_CATEGORY))


But thi sexpression doent display subtotals. The radio button for sub total has been selected in the presentation tab.


How do i ensure that the subtotals is displayed?


Thanks,

Divya

1 Reply
stigchel
Partner - Master
Partner - Master

The Only function only(!) returns a result when there is one possible result and for the subtotals there are several. Why don't you use

=Sum({1} AGGR (NODISTINCT SUM({ <QUARTER_YEAR = {">=$(vFiscalStart)<=$(vFiscalEnd)"}, [PRODUCT_CATEGORY]=, PRODUCT=> }  SALES), [PRODUCT_CATEGORY]))


To disregard all selections, or


=Sum({<Product=,[PRODUCT_CATEGORY]=>} AGGR (NODISTINCT SUM({ <QUARTER_YEAR = {">=$(vFiscalStart)<=$(vFiscalEnd)"}, [PRODUCT_CATEGORY]=, PRODUCT=> }  SALES), [PRODUCT_CATEGORY]))


to disregard selctions in either Product or [PRODUCT_CATEGORY]