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

Calculated Dimensions with subtotals

I have a pivot table with calculated dimensions and two expressions that are in the crosstab part of the table.

            

CustomerQuote NumberQuote Own OrgQuote Fulfill OrgQuote Line NoQuoted PriceTotal QuotedInvoiced QtyTotal BilledRemaining

May-2015

Dispatched

Total Revenue
Customer Name34206EUEU16.111110--
Customer Name34206EUEU14.111101--
Customer Name34206EUEU12.1111011.001.00
Customer Name34206EUEU3.11.0011101.001.00
Customer Name34206EUEU2.11.004422196.63137.50
Quote Total ????????????????????????200.65140.31

How do i get subtotals appearing for the "Total Quoted", "Invoiced Qty", "Total Billed","Remaining" which are calculated dimensions columns?

The "Dispatched" and "Total Revenue" columns are expressions and appear for each month of the year and the sub-total works properly for each month.

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

I dont think that the dimensions are the issue - rather the expressions. You may have expressions using naked fields*, and these cannot be evaluated at a total level as there are more than one possible value for the field. If you post more detail, at least the full set of dimensions and expressions, how you want to break for subtotals and the complete definition of any variables you use in any of the above, you will be able to get useful and accurate suggestions.

* fields outside of an aggregate function (like Sum(), Count(), Max()...)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Jonathan the expressions totals in my applications are correct; I just made a mistake when entering them for this question and didn't realize.

The columns not mention below are all normal dimensions with just a [field name] selected; this also includes the  "Quoted_Month_Year" column which is used in the pivot part of the table with the Dispatched and Total Revenue columns.

DIMENSIONS.

----------------

Calculated Dimension Column - Quoted Price

=NUM(AGGR(

    SUM($(vOrderPrice)),

    %ORDER_KEY

),'$(MoneyFormat)')

Calculated Dimension Column - Ordered

=NUM(AGGR(

    SUM($(vOrderQuantity)),

    %ORDER_KEY

),'$(MoneyFormat)')

Calculated Dimension Column - Total Quoted

=NUM(AGGR(

    SUM($(vHistoricQuotedMonthly)),

    %ORDER_KEY

),'$(MoneyFormat)')

Calculated Dimension Column - Invoiced Qty.

=NUM(AGGR(

    SUM(if([Invoice Type]<>'UNB',Alt([Quantity Invoiced],0),0)),

    %ORDER_KEY

),'$(MoneyFormat)')

   

Calculated Dimension Column - Total Billed.

=NUM(AGGR(

    SUM($(vRevenueBilledAmt)),

    %ORDER_KEY

),'$(MoneyFormat)')

Calculated Dimension Column - Remaining Column.

=NUM(AGGR(SUM($(vHistoricQuotedMonthly))-sum($(vRevenue)),%ORDER_KEY),'$(MoneyFormat)')

Calculated Dimension Column - % Remaining

=NUM(alt(AGGR(if((SUM($(vHistoricQuotedMonthly))-sum($(vRevenue)))/(SUM($(vHistoricQuotedMonthly)))=-0,0,((SUM($(vHistoricQuotedMonthly))-sum($(vRevenue)))/(SUM($(vHistoricQuotedMonthly))))),[Quote Number],[Quote Line Number]),0),'#,##0.00%')    

   

EXPRESSIONS.

----------------

Expression -  Dispatched.

=sum(AGGR(SUM(Alt([Quantity Invoiced],0)),%ORDER_KEY))

Expression - Total Revenue.

=NUM(sum(AGGR(SUM($(vRevenue)),

    %ORDER_KEY

)),'$(MoneyFormat)')

Thanks

Kevin.