Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

Subtraction of subsets

Hi all,

I am using this expression which works fine:

Count(Distinct {<[Calld]={'Inbound'}>} [%CallId]) - Count(Distinct {<[Calld]={'Inbound'}, [ET]={'TALKING'}>} [%CallId])

The result is correct when an other dimension  is filted(sliced) with only one value (the mentioned dimension is not part of any dimension in this expression).

The result becomes wrong when the filted dimension has more than one values. Can anybody help?

Thanks.

George

1 Solution

Accepted Solutions
Highlighted
Creator III
Creator III

This is the correct answer:

Sum(Aggr(Count(Distinct {<[Calld]={'Inbound'}>} %CallId), Dimension(s)))
-
Sum(Aggr(Count(Distinct {<[Calld]={'Inbound'}, [ET]={'TALKING'}>} %CallId), Dimension(s)))

View solution in original post

5 Replies
Highlighted
Specialist II
Specialist II

Sounds like you might need an Aggr(), where Dimension(s) are the dimension you need to slice by

Sum(<[Calld]={'Inbound'}>} [%CallId])>} Aggr(Count(Distinct {<[Calld]={'Inbound'}>} [%CallId]),Dimension(s)))

-Sum(<[Calld]={'Inbound'}, [ET]={'TALKING'}>} Aggr( Count(Distinct {<[Calld]={'Inbound'}, [ET]={'TALKING'}>} [%CallId]),Dimension(s)))

Highlighted
Creator III
Creator III

In your solution there are some syntax errors with some curly brackets. Couldn't figure it out to fix it by myself. Thanks for your help.

Info: "[Calld]" is a tablename

Highlighted
Specialist II
Specialist II

Highlighted
Creator III
Creator III

Thank you for your reply. I checked the online help already. My Problem is, how to connect the bridges between these Aggregations. E.g.:

"Sum(<["  
Must be this Sum of everything or only for the first part, before the subtraction?
Same question with the first "<["

Sum(<[Calld]={'Inbound'}>} [%CallId])>}
In your solution there are two ">}" . For me not logical. It is missing one "<}"

Thanks.

Highlighted
Creator III
Creator III

This is the correct answer:

Sum(Aggr(Count(Distinct {<[Calld]={'Inbound'}>} %CallId), Dimension(s)))
-
Sum(Aggr(Count(Distinct {<[Calld]={'Inbound'}, [ET]={'TALKING'}>} %CallId), Dimension(s)))

View solution in original post