Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
LINKEDIN LIVE: Democratizing data to enhance customer-centricity. JULY 29TH REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help me pls, I can't Distinct and Sum T_T

I'm new Qlikviewer, Please help me

My problem is I can't Distinct and sum value T_T

My data is

IDMONEY
1500
1500
2300
2300
3300
3300
4500

I want to distinct ID and sum MONEY

is

IDHeader 2
1500
2300
3300
4500

so sum money is 500+300+300+500 = 1600 from distinct ID

and I want to use codes in Expression on Graph object

Thank you and Sorry for my English language

8 Replies
jonathandienst

Perhaps:

     Sum(Aggr(Only(MONEY), ID))

Or

     Sum(Aggr(Max(MONEY), ID))

But you may want to fix your data model to remove the duplicates.

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

Create the straight table

Dimension : ID

Expression :

sum(distinct MONEY)

Check expression total mode as "Sum of rows"

its_anandrjs

In any straight table

Dim:- ID

Expre:- sum(Disctinct MONEY)

Regards

Anand

Chanty4u
Champion III
Champion III

Dimension: ID

Exp: =SUM(DISTINCT MONEY)

Chanty4u
Champion III
Champion III

or try dis

dim:ID

Exp :=Sum(Aggr(DISTINCT(MONEY), ID))dsi.PNG

Not applicable
Author

!Hi,

Use :

=Sum(Aggr(sum(DISTINCT Money),ID))

Attached sample for the same.

Regards,

Anjali Gupta

sunny_talwar

In addition these should also work:

=Sum(Aggr(Avg(Money), ID)

or

=Sum(Aggr(Sum(DISTINCT Money), ID)

jonas_rezende
Specialist
Specialist

Hi, Amornsak Nakvisut.

Another suggestion is, you can treat the script. See example below.

Script

VALUE:

LOAD * Inline [

ID, MONEY

1, 300

1, 300

2, 500

2, 500

3, 300

3, 300

4, 500

];

NoConcatenate


VALUE_MONEY:

LOAD

Distinct

ID,

MONEY

RESIDENT VALUE;

DROP TABLE VALUE;


Document

Dimension: ID

Expression: Sum(MONEY)

Hope this helps!