Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
sylvesterjesuda
Contributor II
Contributor II

Count against Dim2

Hi,

I have a example data like below in which I would like to take the count of Dim 2 against Dim 1.

(ie) In the Chart, I want Dimension as Dim1, In the expression, I want the Count 3 for A.


Can anyone help to bring the solution for it, since if I use the count formula, I get the count for A as 2 which is wrong.

Example Data:-

Dim1Dim2
A
AB
BA
CD
A
AB
BC
C D

Best Regards

Sylvester J

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Sylvester,

Try this.

Substringcount(Concat(Total Dim2,'|'),Dim1)

View solution in original post

7 Replies
vishsaggi
Champion III
Champion III

Why you have to get three? Is the above data sample right?

sylvesterjesuda
Contributor II
Contributor II
Author

Yes its right... Its just like we use Countif function in excel

See the result in excel below, how can it be done in expression as result where the Dim1 should be in expression.

 

Dim1Dim2Result
A0
AB3=COUNTIF(B:B,A3)
BA2
CD1
A0
AB3
BC2
CD1
vishsaggi
Champion III
Champion III

May be this?

= COUNT (TOTAL <Dim2> Dim2)

vishsaggi
Champion III
Champion III

May be rwunderlichstalwar1‌ can give any suggestions or ideas please...

Lisa_P
Employee
Employee

Why are you loading Dim1 ? Is it to limit Dim2 values ? There is no relevance to the row levels.

If you only load Dim2, you can count how many of each one, the only thing you are looking for is matching the Dim1 values.

Thread 309563.PNG

tamilarasu
Champion
Champion

Hi Sylvester,

Try this.

Substringcount(Concat(Total Dim2,'|'),Dim1)

sylvesterjesuda
Contributor II
Contributor II
Author

Heartful Thanks Tamilarasu, Your answer is perfect and it is an timly help....