mikaelwins
mikaelwins

Reputation: 43

Group on sum of distinct values in Tableau

I'm using Tableau 8.3 and i'm trying to find out how to group on each of the values that I find after making a "count of distinct values".

To illustrate the case I have made a fictive dataset which includes 58 rows (buys), 7 different IDs (customers) and 5 different products. Then I have made a count distinct to find out how many of the 5 different products each ID have bought. It looks like this.

ID1 = 4
ID2 = 4
ID3 = 5
ID4 = 4
ID5 = 3
ID6 = 4
ID7 = 2

Now I want to turn the view around and find out how many of the IDs who have bought X different products. It should ultimately look like this.

2 = 1
3 = 1
4 = 4
5 = 1

Hope to find a solution by posting here! Thank you,

Mikael

Upvotes: 2

Views: 17350

Answers (1)

Inox
Inox

Reputation: 2275

You need to update to Tableau 9.0 to achieve that (in a fast way).

You can create a calculated field named #of products:

{ FIXED [id_customer] : COUNTD([id_product]) }

Then you can cross the [# of products] with COUNTD(id_customer) to get what you want.

In older versions of Tableau you need to create a new table in a proper format (1 line per customer with the aggregations) and connect to it.

Upvotes: 8

Related Questions