Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count multiple values based on distinct values

Hi Team,

I am trying to write an expression which would list down all customers who are not following the below rule.

Rule to be followed is: One Project ID should only have a single Customer.


Eg:

 

Project IDCustomer Name
112SERVICES PRIVATE LIMITED
112GlobalSoft Pvt ltd
345Tech Pvt ltd
345UI PRIVATE LIMITED


=aggr(if(Count(DISTINCT([Project ID]))=1,if(count(distinct([Customer Name]))>1,[ Customer Name])),[Customer Name])

I tried set analysis with aggregation function couldn't figure out how to get the above solution

1 Solution

Accepted Solutions
sunny_talwar

May be this in a straight table:

Dimension

Customer Name

Expression

Avg({<[Project ID] = {"=Count(DISTINCT [Customer Name]) > 1"}>}1)

or text box object like this

Concat(DISTINCT {<[Project ID] = {"=Count(DISTINCT [Customer Name]) > 1"}>} [Customer Name]), Chr(10))

View solution in original post

6 Replies
Anil_Babu_Samineni

What was the logic behind on this, I am not fully understand your concern. I am assuming this?

I would highly recommend to you, Don't create 2 Threads for single issue

If(Count(DISTINCT [Project ID]) = 1 and Count(DISTINCT [Customer Name]) >1, [Customer Name])


OR


Aggr(If(Count(DISTINCT [Project ID]) = 1 and Count(DISTINCT [Customer Name]) >1, [Customer Name]), [Customer Name],[Project ID])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
swuehl
MVP
MVP

Maybe create a straight table with project id and customer name as your two dimensions and as expression

=Count(TOTAL<[Project ID]> DISTINCT [Customer Name]) = 1

Enable 'suppress zero values' on presentation tab (and you can hide the expression column if you want, too)

This should only show the combinations of projects and customers where your condition is fulfilled.

sunny_talwar

May be this in a straight table:

Dimension

Customer Name

Expression

Avg({<[Project ID] = {"=Count(DISTINCT [Customer Name]) > 1"}>}1)

or text box object like this

Concat(DISTINCT {<[Project ID] = {"=Count(DISTINCT [Customer Name]) > 1"}>} [Customer Name]), Chr(10))

MarcoWedel

or using calculated listbox:

QlikCommunity_Thread_248724_Pic1.JPG

QlikCommunity_Thread_248724_Pic2.JPG

QlikCommunity_Thread_248724_Pic3.JPG

hope this helps

regards

Marco

Not applicable
Author

Thanks Marco for the file. It helped me to analyze the data a from a different view.

MarcoWedel

you're welcome

glad it helped

regards

Marco