Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

kennethand
New Contributor II

Opposite of distinct

How do you work with distinct the opposite way?

If you have data likes this:

IDSales
110
220
3100
115
25
230

If I like to sum Sales but only for IDs which occur twice or more. How do I do that?

In this case I will get a table lieks this (ID 3 will not be summed as it only occurs once)

 

IDSum of sales
255
325
1 Solution

Accepted Solutions
woshua5550
Contributor III

Re: Opposite of distinct

you can do it by scripting or expression

if you don't want to load unique ID at all, plz follow Antoni's step

or you can do it by creating a straight table with ID as dimention and

"Sum({<ID={"=Count(ID)>1"}>}Sales)" as expression

3 Replies
Luminary
Luminary

Re: Opposite of distinct

Hi, maybe something like:

If(Count(ID)>1, Sum(Sales), '')

Capture.PNG

antoniotiman
Honored Contributor III

Re: Opposite of distinct

May be this

LOAD ID,Sales Where Count > 1;
LOAD ID,Sum(Sales) as Sales,Count(ID) as Count Inline [
ID, Sales
1, 10
2, 20
3, 100
1, 15
2, 5
2, 30
]
Group By ID
;

woshua5550
Contributor III

Re: Opposite of distinct

you can do it by scripting or expression

if you don't want to load unique ID at all, plz follow Antoni's step

or you can do it by creating a straight table with ID as dimention and

"Sum({<ID={"=Count(ID)>1"}>}Sales)" as expression

Community Browser