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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Partial sums, unexpectd result

Hi All,

I'm trying to add up a set of monetary figures in a pivot table. The income comes in in several different currencys. Depending on what currency the product is bought in, It'l then convert it to sterling pounds. From this point, im trying to add up the new sterling amounts

There are a number of sliders which can alter the variables for the currency conversions which the user can set within the app. So it can be altered to the changing currency rates, so this isn't done via script.

The pivot table itself is quite simple with dimension of

MemberType

MbrSub_Price

month

year

the expression is as follows:-

if(MbrSub_CurrencyId =  1 ,   sum((MbrSub_Price / $(HKDollar))/MbrSub_Duration) ,

    if(MbrSub_CurrencyId =  2 ,   sum((MbrSub_Price / $(USDollar))/MbrSub_Duration),

        if(MbrSub_CurrencyId =  3 ,   sum((MbrSub_Price / $(NNaire))/MbrSub_Duration) ,

            if(MbrSub_CurrencyId =  4 , sum((MbrSub_Price / $(CYuan))/MbrSub_Duration) ,

                if(MbrSub_CurrencyId =  5 ,  sum((MbrSub_Price / $(NZDollar))/MbrSub_Duration),

                    if(MbrSub_CurrencyId =  7 ,  sum((MbrSub_Price / $(Euro))/MbrSub_Duration) ,

                        if(MbrSub_CurrencyId =  8 ,   sum((MbrSub_Price / $(IRupee))/MbrSub_Duration),

                        sum( MbrSub_Price/  MbrSub_Duration))))))))

Each line that is produced is working fine and calculating correctly ,

totals are calculated by using partial sums on the product - but these are incorrect

I have a list box with all the different currencys in it, if one of these are selected the totals work fine however, if i deselect or select 2 currencys then the partial sums total is equal to the original calc totals without any conversion

i.e.

sum( MbrSub_Price/  MbrSub_Duration)

due to the nature of the sheet, im sorry but i cant add the actual file but ive done a mock up

Basically I just want it to add up whatever it sees in the column

so if you look at the 2 columns original and converted , original calculates correctly but converted doesn't

any ideas ?

thank you

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi attach is an example

you need to use aggr function , that creates an array of values for each row and summarize them

your function doesn't work because in the total row you have all currencies

View solution in original post

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hi attach is an example

you need to use aggr function , that creates an array of values for each row and summarize them

your function doesn't work because in the total row you have all currencies

Not applicable
Author

Thank you