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

Chart ignoring distinct expression when second element is added to stack bar chart

I have a simple bar chart which uses two values SID and STATUS.

STATUS is the dimension and the expression is Count(distinct SID).

However i want to add a third value so i can have stacked bar charts.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Please don't clean up discussions like that. The responses may not all have been useful to you, but you can't be sure other people did not find them useful in some way. You also remove all the context and relevant information so nobody can now figure out what the heck this discussion was about in the first place.

Attached is the qvw with a solution.


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Gysbert_Wassenaar

Try adding count(distinct COMP) as second chart expression.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Could you upload a small sample QVW and your expected result? It's unclear to me how your setting / data model looks like and what you are trying to achieve.

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Can u share  sample application ?

matthewp
Creator III
Creator III
Author

I tried to clean up the comments to make it easier for future use but it deleted your answer which worked perfect!!!

Edit the above and i will mark it as correct...

count(DISTINCT SUPPLIER_ID)*

count(total <STATUS> DISTINCT SUPPLIER_ID)/

sum(total <STATUS> aggr(count(DISTINCT SUPPLIER_ID),STATUS,COMPANY))

Gysbert_Wassenaar

Please don't clean up discussions like that. The responses may not all have been useful to you, but you can't be sure other people did not find them useful in some way. You also remove all the context and relevant information so nobody can now figure out what the heck this discussion was about in the first place.

Attached is the qvw with a solution.


talk is cheap, supply exceeds demand
tresesco
MVP
MVP

I found this (not really THIS but how it was before deletion) discussion to be one the better discussions. But alas! what you have done. It's hard now to make out the actual requirement you have that was derived after a long chain of discussions. I will try to recollect the problem in my words for future references.

     There is a combo chart : Dim1: STATUS   Expression: Count(Distinct SUPPLIER_ID)

     This gives distinct counts STATUS wise.

Now second dimension : Company is added to get stacked bars which would break up the distinct counts (that was coming STATUS wise) into Company and NOT distinct Company wise. I.e. - the total distinct count should match the number that comes STATUS wise (with no Company dimension). If the expression - Count(Distinct SUPPLIER_ID) is used, count() decides dintinction on Company as well, and that is not desired.

This will help me understand the case when I revisit this thread which I bookmarked. Please don't clean-up this even if you find this not really helpful.

kamielrajaram
Creator III
Creator III

Hi,

Maybe try this in your expression

Count(total <STATUS> DISTINCT  SUPPLIER_ID)/
count(total  <STATUS> distinct COMPANY)