Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Bar chart

Guys,

I have the data as shown below,

FieldCustomerID
AC11
BC22
CC13
DC21

Expected Output:

Screenshot_20.png

I want the no. of Fields which has same IDs. Both fields have same IDs but from different customers in the above bar chart.

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

try below

sum(AGGR(if(Count({<Customer>}DISTINCT TOTAL <ID> Customer)>1,1,0),Field,Customer,ID))

To understand how its working do the below

Use ID as Dimension and below expression to count how many times the ID field is Repeated for different customer

=Count({<Customer>}DISTINCT  TOTAL  Customer)

So using

Count({<Customer>}DISTINCT TOTAL <ID> Customer)>1     << gives us the same view by ID field

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

6 Replies
vinieme12
Champion III
Champion III

sum(AGGR(if(Count(DISTINCT TOTAL <ID> Customer)>1,1,0),Customer,ID))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

Also you have close your earlier Thread!!

Qlik Community Tip: Marking Replies as Correct or Helpful

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Thanks Vineeth, It's working.. but when I make a selection in Customer, there is no value in the chart. Could you please explain this expression in detail?

I couldn't understand it.

vinieme12
Champion III
Champion III

try below

sum(AGGR(if(Count({<Customer>}DISTINCT TOTAL <ID> Customer)>1,1,0),Field,Customer,ID))

To understand how its working do the below

Use ID as Dimension and below expression to count how many times the ID field is Repeated for different customer

=Count({<Customer>}DISTINCT  TOTAL  Customer)

So using

Count({<Customer>}DISTINCT TOTAL <ID> Customer)>1     << gives us the same view by ID field

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Thank you so much Vineeth. But I have one more doubt on this.

Assume instead of using this expression in charts directly (in run time), I store this expression in the script using SET or LET function in a variable.

Now could you tell me which method will take loading issues in the front end from below,

1. Writing expressions in the charts directly - first data will be fetched into the model and then the expression will be processed.

2. Store those expressions in the script using SET or LET functions - Expressions are processed and will be stored in memory.

please say which method is preferable and also please intimate whether above mentioned 2 points are correct.

Anonymous
Not applicable
Author

Also Vineeth, I need to know whether this expression can be done as a dimension by script wise rather than an expression.