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: 
Not applicable

Doubts about repeated rows

Hi everybody. I have repeated values in a table, and i have problems showing them. My english leaves a lot to be desired, i´ll put an example.

Field 1 = 2070

Field 2 = 1

Field 3 = sum(field 1 - field 2)= 6207

Ok.. i guess the row is repeated 3 times and i have 2070 x 3 and 1 x 3 but i can´t see the values and if the user sees this it seems like an error. What i have to do to see the field 1 as 6210 and the field 2 as 3 ??

Thank you all

Greetings.

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

Field 1:   sum(2000)

Field 2:  sum(1)

Field 3:  sum( 1999)    or  sum (2000 - 1) or  sum (2000) - sum(1)  ...  your choice

View solution in original post

12 Replies
JonnyPoole
Employee
Employee

In your expression formula,  are you using 'sum(Field1)'   ?   Or just 'Field1' ?

its_anandrjs

I suggest use Distinct for this this will take only 2070 and 1 then write like

Field 3 = Sum(Distinct field 1 ) - Sum( Distinct field 2 )



Regard

Anand


Not applicable
Author

Í´ve just edited my post.

The expressions are:

Field 1 = 2070

Field 2 = 1

Field 3 = sum(field 1 - field 2)= 6207

Sory for this.

Is clear now? The F1 and F2 dont have sum. I tried but it doesn´t works.

Not applicable
Author

Í´ve just edited my post.

The expressions are:

Field 1 = 2070

Field 2 = 1

Field 3 = sum(field 1 - field 2)= 6207

Sory for this.

Can you read again? Sory!

its_anandrjs

Did you try like

Field 3 = Sum(Distinct field 1 ) - Sum( Distinct field 2 )

Not applicable
Author

yeah, and it´s works .I mean it changes the field 3, but isnt that incorrect? 6207 is the real value, isnt the problem with the values of fields 1 and 2 ?

Regards.

PD: Please tell me if my english isn´t clear and i´ll try to explain it better.

JonnyPoole
Employee
Employee

There a multiple ways to do this calculation depending on what you want to do .

The below example shows 2 sales for the same customer, notice how depending on the expression, you either do the subtraction at the details and sum the results OR you sum the details and subtract the totals.

If you remove the 2nd dimension you can see the results.

So multiple answers depending how you want the calculations to work...

Capture.PNG.png

Not applicable
Author

Try this -

Field 1 = sum(2070)

Field 2 = sum(1)

Field 3 = sum(field 1 - field 2)= 6207

Since this may be an entirely different issue (data model, naming, etc), if you can attach a sample qvw that would be great.

Not applicable
Author

Ok im a bit confused now haha.

Look, my field 3 is ok. I´d like to see the field 1 and 2 in the correct way to see for example 6207 // 3 // 6210.

Thank you

Greetings.