Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

steve1982
New Contributor II

Calculate Total on Table

Hi All,

I wish to calculate the Total by Part as below by using below expression, but it not allow to me filter any dimension.

Company NamePart NoQtyTotal By Part
A1100100
B22030
C33070
A21030
C34070

 

SUM({1}TOTAL <Part No>Qty)

Thanks for advice.

Steve

1 Solution

Accepted Solutions
Partner
Partner

Re: Calculate Total on Table

maybe this:

rangesum( aggr( NODISTINCT sum( {< [Company Name] >} Qty ), [Part No] ) )

View solution in original post

7 Replies
Partner
Partner

Re: Calculate Total on Table

what about SUM(TOTAL <Part No> Qty) ?

Highlighted
steve1982
New Contributor II

Re: Calculate Total on Table

When I filter Company A, the part 2 show 10, instead of 30.

I need it show the grand total of each part, even filter by company or other dimension.

clipboard_image_1.png

 

Thanks

Steve

Partner
Partner

Re: Calculate Total on Table

You could do it inside the script:

TABLE:
LOAD * INLINE [
Company Name, Part No, Qty, Total By Part
A, 1, 100, 100
B, 2, 20, 30
C, 3, 30, 70
A, 2, 10, 30
C, 3, 40, 70
];

Left Join (TABLE)
LOAD
[Part No],
Sum(Qty) AS TOTAL
Resident TABLE
Group By
[Part No]
;

Partner
Partner

Re: Calculate Total on Table

maybe this:

rangesum( aggr( NODISTINCT sum( {< [Company Name] >} Qty ), [Part No] ) )

View solution in original post

MVP
MVP

Re: Calculate Total on Table

You can override the company selection in the expression:


SUM({<[Company Name]>} TOTAL <Part No> Qty)

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

Re: Calculate Total on Table

You can try this

Sum({<[Company Name]>} TOTAL <Part No> Qty) * Avg(1)
steve1982
New Contributor II

Re: Calculate Total on Table

Thanks all, manage to find a solution 😀

Thanks

Steve