Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chinedu_CV
Contributor
Contributor

Aggr suming twice

Hi guys,

it seems the aggr function in my set analysis counts the figures twice and returns a wrong sum, if i have more than entry in a month (see Screenshot). Is there a way to correct this? 

 

This example in the screenshot should return 1479 and not 6463.

Labels (1)
5 Replies
G3S
Creator III
Creator III

can you please try summing by distinct ?

Chinedu_CV
Contributor
Contributor
Author

Hey,
I tried it but its not working. 

Money(sum(aggr(RangeSum(Above(sum(distinct{< [date.Kalender.JahrUndMonat]=>}Betrag_kennzahl),0,RowNo())),Schema,Konto,Mandant,date)))

marcus_sommer

It's not clear why you applies an interrecord-function and an aggr() to the sum()? Further neither the conditions nor the used dimensions are fitting to your object respectively the first expression. I suggest that you just start with sum(Betrag_kennzahl) and count(Betrag_kennzahl) to see which data are really there.

Chinedu_CV
Contributor
Contributor
Author

Hey Marcus,

doing this sum(Betrag_kennzahl) and count(Betrag_kennzahl) of course work, but that is not the goal. The goal is to get a rangesum of all the figures till the selected date. This works but I cant not get a sum of the result to display in my privot table and this is where Aggr comes in. Otherwise, I cant use sum (rangesum()). 

The use of aggr here seems to work well as well, but delivers the wrong result, when in a month I have two enties (instead of just one entry). 

So I need to find a way to make my aggr function do the range sum calculation and deliver the correct result, especially in the months where there are two entries. 

marcus_sommer

If there is more as a single result by the aggr() you may need to set it to NODISTINCT and/or also some TOTAL within the outer aggregation. Essentially will be that the applied dimensions for the aggr() are the right ones which seems not be the case here because your object has a dimension Sachkonto which isn't included in the aggr() but various other fields.

Beside of this you may also look if you could split the calculation by querying the dimensionality().