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

Different value of a field vs. sum(field) only in some lines

Hello,

I have a problem with the sum function in a field. As you can see the column of the field value and the column of sum(field) had to be the same but in three registers it show me four times this value.

Can anybody give me a solution?.

ProblemaQlik.JPG

Thanks.

3 Replies
Anil_Babu_Samineni

Wonder, How it comes. Would you share application please?

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
Gysbert_Wassenaar

This can happen when you have multiple records in one table that have the same [ID TCV Inicial] and  [TCV Inicial.Total Importe Neto] values.

For example if you have a table like this:

MyTable:

LOAD * INLINE [

Field1, Field2

A, 2

B, 3

C, 4

C, 4

C, 4

];

And you create a pivot table with Field1 and Field2 as dimensions and sum(Field2) as expression you'll see something like this:

A, 2, 2

B, 3, 3

C, 4, 12

If the fields in your pivot table come from different tables then there are most likely some records in one table that have multiple associated records in the other table.


talk is cheap, supply exceeds demand
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

It looks like your data has duplications in it. It can happen if you join two tables when one of them has duplicate instances of the join keys. It can also happen when you link multiple tables through tables with duplicate rows.

When you use the field name with no functions, the ONLY() function is being used by default. It shows the actual "de-dupplicated" value. The function sum(), on the other hand, summarizes all the duplicated values, therefore showing triple or quadruple values.

So, the solution to your problem is in your data model. Find the source of the duplication.

Cheers,

Oleg Troyansky

Upgrade your Qlik skills at the Masters Summit for Qlik - coming to Boston, MA this October!