Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
pgloc2020
Creator
Creator

Sum with IF condition and distinct IDs

Hello all,

I am trying to generate 2 KPIs to display total Debit and Credit amounts separately.

In my dataset I have a values like below. ID column has some duplicate ID's -

pgloc2020_0-1677179233850.png

I have tried many expression including below expressions but none of it giving me the correct total -

Sum({<Financial Transaction Type = 'DA Credit'>} Aggr(Sum(DISTINCT {<Financial Transaction Type = 'DA Debit'>} AMOUNT), ID)) or

Sum(aggr(sum(DISTINCT if(Financial Transaction Type = 'DA Credit', ID)), AMOUNT)) or 

SUM(distinct if ([Financial Transaction Type]='DA Debit', [AMOUNT])) - This one is working but it is not eliminating the duplicate IDs amount. 

Kindly help me to get it as it is required for my project.

Thanks in advance.

 

 

Labels (1)
1 Reply
Lisa_P
Employee
Employee

Try this:

Sum({<[Financial Transaction Type] = {'DA Credit'}>} DISTINCT  AMOUNT)

and 

Sum({<[Financial Transaction Type] = {'DA Debit'}>} DISTINCT  AMOUNT)