Forum Discussion
Using two Distinct Count of fields in a matrix
- 4 years ago
In this scenario, its essence is to count according to the combination of cat and dog. However, the matrix cannot combine people with different ids, so you need to create a measure. In matrix, measure cannot be put in Rows (see picture below). So it needs to create a dimension table first.
(1) create a dimension table
(2) create a measure
Count of Owner IDs = CALCULATE ( DISTINCTCOUNT ( 'Table'[owner_id] ), FILTER ( ALL ( 'Table' ), CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( ALLEXCEPT ( 'Table', 'Table'[owner_id] ), 'Table'[species_id] = 1 ) ) = MIN ( 'dimension table'[Dog] ) && CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( ALLEXCEPT ( 'Table', 'Table'[owner_id] ), 'Table'[species_id] = 2 ) ) = MIN ( 'dimension table'[Cat] ) ) )result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
MPetramalo214 I totally missed it, I was supposed to work on this. Anyhow, you have a great solution but I feel that solution is only good if you have two species, if you have more than 2 species (maybe it never happens) this solution is not going to work. Anyhow, I guess you are in a good place, sometime in the near future I will look into a more scalable solution which will be able to address any change in the data.
Cheers!!
Cheers! Good to know the limitations of this solution. I will work for the foreseeable future, but I'm always interested in learning more scaleable options I can apply to future use cases. Thanks for the input!