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

Calculating total

Hi

I have a spreadsheet which looks like

Supplier    Tier      Value     Rebate

A                1              100          1%

B                2            200          5%

C                1             50            1%

D                 2             300          2%

I can calculate each line with no problem by using

=sum (value) * sum(Rebate)

The problem comes when i want to total all rebate by Tier

Thanks

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Do you mean this?

=sum (TOTAL <Tier> value) * sum(TOTAL <Tier> Rebate)

OR

sum(aggr(sum(value) * sum(Rebate), Supplier, Tier))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

10 Replies
prma7799
Master III
Master III

Try like this

Test:

LOAD * , SubField(Rebate,'%',1)  as Rebate_New;

LOAD * Inline [

Supplier,    Tier    ,  Value     ,Rebate

A,                1   ,           100 ,         1%

B ,               2    ,        200    ,      5%

C  ,              1     ,        50     ,       1%

D   ,              2     ,        300    ,      2%

];

ccsimo16
Contributor III
Contributor III
Author

Hi PM

Thanks for the reply, how would i write the Expression

Thanks

Chris

marcus_sommer

Try it with the following expression:

sum(aggr(sum(value) * sum(Rebate), Supplier, Tier))

- Marcus

Anil_Babu_Samineni

Do you mean this?

=sum (TOTAL <Tier> value) * sum(TOTAL <Tier> Rebate)

OR

sum(aggr(sum(value) * sum(Rebate), Supplier, Tier))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ccsimo16
Contributor III
Contributor III
Author

Thanks All Great Community as always

Anil_Babu_Samineni

You can mark proper correct answer

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
prma7799
Master III
Master III

Like this??

sum(Aggr(sum(value) *  sum(Rebate_New), Supplier, Tier))

ccsimo16
Contributor III
Contributor III
Author

Hi Anil

it was  sum(aggr(sum(value) * sum(Rebate), Supplier, Tier))


How would i change to work as a dimension?

Thanks

Anil_Babu_Samineni

May be remove Sum(), Perhaps like below?

Aggr(sum(value) * sum(Rebate), Supplier, Tier)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful