Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
curiousfellow
Specialist
Specialist

Total distinct count

I want to use the sum of  a distinct count based on two values.

For example my values are

         

recnodeptval
1dept1val1
2dept1val2
3dept1val1
4dept2val1
5dept1val1

So the distinct count for dept1 should be 2

When I use the expression Sum(Aggr(Count(Distinct dept),val)) I get the correct value when I only use [dept] as dimension in a pivot table.

However : I want to use [val] as a dimension too.

How do I have to change my expression ?  

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Count(distinct(dept & val))

MK_QSL
MVP
MVP

COUNT(DISTINCT TOTAL <dept> val)

or

COUNT(DISTINCT TOTAL <val> val)

curiousfellow
Specialist
Specialist
Author

This works fine when no selection is made. Probably I misdefined my question.

This is what i need :

I have to count  every record per year,per dept.

The result should not change when a selection is made. In a chart [val] has to be multiplied with the result of the count.

Because I am still struggling with the "set analysis" options, I don't know how to solve this

hic
Former Employee
Former Employee

You should probably not use Aggr() but instead use set analysis.

     Count ( {1} distinct Val )

See The Aggregation Scope

HIC

berkarmagan
Partner - Creator
Partner - Creator

Hi, how can i use sth like that; count({1}distinct val), it doesnt work like this. What i need is on my post which is Pivot Table total func problem‌. Thanks for now.