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

sum formula doesn't work?!

hi all,

this might be a very normal thing but i can't get my head around it....

i have a fact table with a lot of data (form a hospital), if i select a single patient and a specific activity there remains only 1 record.
That record contains the field "amount" and for this specific patient-activity that reads 1, but if i add the formula sum(amount) it is 2...!

error loading image
(Versec_AANTAL = amount)

Is this because there is a relation with another table 1 on N?

help is appriciated!

greetz,

david

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

David

My guess would be that you have a duplicate record here. The field reference Versec_AANTAL returns the value 1 because both records have that value, but the sum adds them together.

The duplicates could be coming from your source data, or may have been caused during a join in the load script, or due to a relationship in your data - hard to say without seeing your model (or a representative sample)

Hope that helps

Jonathan

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

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

David

My guess would be that you have a duplicate record here. The field reference Versec_AANTAL returns the value 1 because both records have that value, but the sum adds them together.

The duplicates could be coming from your source data, or may have been caused during a join in the load script, or due to a relationship in your data - hard to say without seeing your model (or a representative sample)

Hope that helps

Jonathan

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

Hi Jonathan,

thx for your reply, i made a change in my script, the last reload is now a distinct load..
(the data contains a unique number)

the problem i mentionod is now solved (for this patient) but the totals aren't right yet but i'll try finding out if the other suggestions you made are also causing trouble for me...

thx!

david

Not applicable
Author

i found the other problem but i'll post a new post because it's a different problem.

thx!