Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?.
Thanks.
Wonder, How it comes. Would you share application please?
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.
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!