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

duplicates problem in sum

hi all,

i have a problem in my chart, i did a chart that count and sum(like showing in the example i added).

the problem that in the "withdraw" expression the total is without duplicates, and in WD the total is with duplicates.

does anyone have an idea, i tried to put DISTINCT but it doesnt work.

i am adding my expression, if anybody have any idea.

=sum(aggr(if(sum({<YYYY=,MM=,DD=>} FTD)>0 and

sum(if(Aggr((sum(DEPOSITS) - sum(FTD)),USER_NAME)>0,1))=0 and $(mWithdraws)>0,$(mWithdraws),0),

RET_DESK,R_REPRESENTATIVE,USER_NAME,FTD_CAL.FULL_DATE,ACCOUNT_LANG))

thank you

eran

2 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try Creating a flag for duplicates like

     Load

          Field1,

          Field2,

          If(Peek('Field1')=Field1 and peek('Field2')=Field2,1,0) as DuplicateFlag

     From datasource;

     Before this your data to be ordered.

   

Then Write expression

Without duplicates Sum({<DuplicateFlag={0}>} Field2)

With Duplicates simply use Sum(Field2)

Celambarasan

Not applicable
Author

i understand what you mean but i dont know how to do it with my expression.