Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difficulty with aggr(count(distinct ... stuck, but feel it should be easy!

Hi,

I feel pretty silly to be stuck on this so hopefully someone will have an easy solution...

This is a mock-up of my data. I want to calculate how many different events LA Name X,y,z ... went to (see seccond immage).

count distinct.png

I want it to create a tabe like this:

count-I want.png

I have tried variatoins of this aggr(count(distinct [Event]),[LA Name]) but this produces this instead.

count-iget.png

Any ideas?

Thanks,

Isabel

1 Solution

Accepted Solutions
calvindk
Creator III
Creator III

The

[LA Name] - Count(distinct Event)

should be correct.

Could you upload some test data(where it does not work), so we can see whats wrong?

View solution in original post

6 Replies
Gysbert_Wassenaar

Use LA Name as dimension and count(distinct Event) as expression. But using your sample data that won't give you the result table you're looking for because there are two distinct Event values for Y: 1 and 3.

See attached example.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi,

Yes, I have LA name as the dimension, and I have tried count(distinct Event), however it still seems to count the total number of distinct events, i.e. 3 everywhere, and I am certain that this is not what the underlying data says!

Not applicable
Author

And you are right, that was a typo. For clarity,  the result I want is:

count-I want.png

calvindk
Creator III
Creator III

The

[LA Name] - Count(distinct Event)

should be correct.

Could you upload some test data(where it does not work), so we can see whats wrong?

Not applicable
Author

Ok, so it must be with the way I have linked all my tables... Looking at all the common fields across my data, I have sketched up the structure showing the different tables/tabs I have brought in. Can you see why I am getting the unexpected result? I am really puzzled, but I think it may be an issue with the "Date" field in common.

As background: Every Participant belongs to an LA Name all the time. Participants then attend Events and I have other details about the Event and the LA Name. All this information then gets mapped onto a map of the UK.

tab mapping.png

Not applicable
Author

I think this is now to do with loosely coupled tables and so I will open up a new discussion point with a more appropriate title. Thanks for your responses