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

Sum of sums

Dear Community,

I am struggling to get the sum of two sums in a graph as a header.

The Set analysis is as follows:

='Summe = '& num(fabs(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'711','713','715','717','712','714','716','718'}>}[Menge in ErfassME])),'#.000,00')&'
WA ='& num(fabs(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'711','713','715','717'}>}[Menge in ErfassME])),'#.000,00') &'
WE ='& num(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'712','714','716','718'}>}[Menge in ErfassME]),'#.000,00')

As a result i get the following statement:

DellaCruze_0-1628673563707.png

But instead of calculating 8.458,95 - 6.409,80 = 2.049,15 I want it to return 

8.458,95 + 6.409,80 = 14.867,75

 Is there a way to get this done? Maybe with aggregation function?
Additionally it is to mention that Numbers belonging to "Bewegungsart = 711, 713, 715, 717" are negative(they have a minus - in front).

 

Thank you in advance

 

2 Solutions

Accepted Solutions
stevejoyce
Specialist II
Specialist II

'Summe = '& num(

fabs(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'711','713','715','717'}>}[Menge in ErfassME]))

+

sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'712','714','716','718'}>}[Menge in ErfassME])

,'#.000,00')&'
WA ='& num(fabs(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'711','713','715','717'}>}[Menge in ErfassME])),'#.000,00') &'
WE ='& num(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'712','714','716','718'}>}[Menge in ErfassME]),'#.000,00')

View solution in original post

Kushal_Chawda

@DellaCruze  may be better way would be using rangesum 

num(rangesum( fabs(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'711','713','715','717'}>}[Menge in ErfassME])),
sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'712','714','716','718'}>}[Menge in ErfassME])),'#.000,00')

View solution in original post

7 Replies
avinashelite

Try like this 

1. Use FAB function and convert negative number to positive and then sum it up 

2. Currently you have already calculated the sum separately rite, store the same in 2 variable and use them to sum it up... That would be even more easier

If your not able to resolve please provide the same data/qlik app will help you

stevejoyce
Specialist II
Specialist II

'Summe = '& num(

fabs(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'711','713','715','717'}>}[Menge in ErfassME]))

+

sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'712','714','716','718'}>}[Menge in ErfassME])

,'#.000,00')&'
WA ='& num(fabs(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'711','713','715','717'}>}[Menge in ErfassME])),'#.000,00') &'
WE ='& num(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'712','714','716','718'}>}[Menge in ErfassME]),'#.000,00')

DellaCruze
Contributor II
Contributor II
Author

Thank you very much @stevejoyce ,

your solution fits perfectly. I was not aware of the possibility to use the operator + within the num Columns.

Best Regards

Kushal_Chawda

@DellaCruze  not sure what you are trying to achieve. 

Do you want , "Summe = 2.049,15 

                                                 8.458,95 + 6.409,80 = 14.867,75"

DellaCruze
Contributor II
Contributor II
Author

@Kushal_Chawda 

no this was the result i got.
i wanted the sum of  "8.458,95 + 6.409,80" which is "14.867,75."

The problem was that the operator "+ "was not summing up outside of the num-function.
 Thanks to stevejoyce solution I was able to change the function properly.

Do you have any other ideas how to fix it?

Kushal_Chawda

@DellaCruze  may be better way would be using rangesum 

num(rangesum( fabs(sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'711','713','715','717'}>}[Menge in ErfassME])),
sum({<KAL_Geschäftsjahr_DU={'19/20'},Bewegungsart={'712','714','716','718'}>}[Menge in ErfassME])),'#.000,00')
DellaCruze
Contributor II
Contributor II
Author

You're right!

This solution works too as wished.
Thank you for your response.

Best Regards