Forum Discussion
ihungko
2 years agoFrequent Visitor
How to count based on another column
Hi community folks, I am building a KPI dashboard, but kind of struggling to write the correct measure. Can you please kindly help? Thanks a lot! My dataset is like this, I want to calculate ...
Uzi2019
2 years agoCommunity Champion
Hi ihungko
You can simply write DISTINCTCOUNT().
If you want to take count against only opportunity name.
If this not what you are looking for then let me know the expected output like what other columns you are expecting and count value against it.
ihungko
2 years agoFrequent Visitor
Hi Uzi, thanks for your reply.
DISTINCTCOUNT was my first option, however, there is a sistuation when kpi product group has more than 2, for example like the table below:
The desired outcome would be
| Opportunity Name | Credit |
| Opportunity X | 1 |
| Opportunity Y | 1 |
| Opportunity Z | 1 |
| Opportunity AA | 2 |
| TOTAL | 5 |
But if I use DISTINCTCOUNT on KPI Product Group, it will be 3 in total,
| Opportunity Name | Product Name | Stage | KPI Product Group |
| Opportunity X | Product A | Pending | A |
| Opportunity Y | Product A | Pending | A |
| Opportunity Z | Product A | Pending | A |
| Opportunity AA | Product B | Pending | B |
| Opportunity AA | Product C | Pending | C |