How can I count distinct values under a same month?
Hi everyone,
I currently have a data set for which I would like to count all unique values that are under a same month and a same year. For example, the following table shows two duplicate values (TR ID's) on two different dates. In this case I would only like to count the unique TR ID's for the month of August, 2020 (which should be 6):
I have been trying to use the =COUNT(DISTINCT(COLLECT(.....))) expression, however, it returns "1", when it should count "6".
Thanks in advance,
Carolina
Answers
-
Try something like this...
=COUNT(DISTINCT(COLLECT([TR ID]:[TR ID], Date:Date, AND(IFERROR(MONTH(@cell), 0) = 8, IFERROR(YEAR(@cell), 0) = 2020))
-
Hi Paul, I tried re-creating this formula for my purposes and I'm getting an "#unparseable" when I adjust the equation for my needs. The following formula should return "2":
=COUNT(DISTINCT(COLLECT([Patient number]1:[Patient number]3, [Dosing date]1:[Dosing date]3, AND(IFERROR(MONTH(@row),0) = 1, IFERROR(YEAR(@row),0) = 2022))))
Can you point out what I'm doing wrong? Thank you!
-
Hi @AHANSON
Instead of using @row inside of your MONTH and YEAR functions, you'll want to use @cell.
Try:
=COUNT(DISTINCT(COLLECT([Patient number]1:[Patient number]3, [Dosing date]1:[Dosing date]3, AND(IFERROR(MONTH(@cell),0) = 1, IFERROR(YEAR(@cell),0) = 2022))))
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!