Count of unique values
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello Alteryx Community,
Just started using designer and would greatly appreciate any help with this task that I have spent hours with no respite!
I am looking to feed the Part # and Plant ID as inputs in a spreadsheet and get the below two columns as output in the same spreadhseet:
1. Unique Part #
2. Count of unique Plant IDs corresponding to the unique part #
The below table provides a reference for what I am looking to do with 50,000+ part numbers.
Part # | Plant ID | Part # | count | |
21 | 2 | 21 | 3 | |
21 | 8 | 20 | 2 | |
21 | 6 | |||
21 | 8 | |||
20 | 124 | |||
20 | 11 | |||
20 | ||||
20 | 11 |
Thank you in advance for the help!
Solved! Go to Solution.
- Labels:
- Expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The solution worked like a charm. Thanks Mark!
I do see that the Count Distinct output is counting the empty cells too. Is there a way to exclude them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Before going into the summarize::
iif(isempty(trim(field)),null(),field)
now change the summarize to count distinct non null
cheers,
mark
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Mark,
Pardon my ignorance. Should I be using the formula tool to process the Plant ID column to convert the empty cells to null? I do not see any option at the input of the summarize tool to apply the expression your provided.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Mark,
Used the formula tool and got what I needed. Thanks a ton for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Pandas nunique() is used to get a count of unique values. To download the CSV file used, Return Type: Integer – Number of pandas unique values in a column.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Used it yesterday (Sept 19th). Thanks 🙂
