Forum Discussion
Distinct count in one column depending on the data in another column
- 1 year ago
Hi Astudham ,
I tried DAX formula on a similar dataset for calculating the distinct count of shapes per color:
Shape Count =
CALCULATE(
DISTINCTCOUNT('Table'[Shape]),
ALLEXCEPT('Table', 'Table'[Color])
)Here’s the dataset I used:
| Color | Shape |
| Red | Square |
| Red | Square |
| Blue | Square |
| Green | Square |
| Green | Circle |
| Red | Circle |I got the following output:
| Color | ShapeCount |
| Red | 2 |
| Blue | 1 |
| Green | 2 |If this response was helpful, please accept it as a solution and give kudos to help others in the community.
Hi Astudham ,
I tried DAX formula on a similar dataset for calculating the distinct count of shapes per color:
Shape Count =
CALCULATE(
DISTINCTCOUNT('Table'[Shape]),
ALLEXCEPT('Table', 'Table'[Color])
)
Here’s the dataset I used:
| Color | Shape |
| Red | Square |
| Red | Square |
| Blue | Square |
| Green | Square |
| Green | Circle |
| Red | Circle |
I got the following output:
| Color | ShapeCount |
| Red | 2 |
| Blue | 1 |
| Green | 2 |
If this response was helpful, please accept it as a solution and give kudos to help others in the community.
- Astudham1 year agoNew Member
This helped. Thank you very much