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 this is a really interesting question, just wondering if this is what your raw data looks like:
if not, can you paste sample raw data in a table format?
I've got this filtered down to just my owner id, as well as dropped about 20 columns that aren't important, rarely have info etc. The three columns I really need are:
id which is the animal identifier
owner_id which is the owner identifier
and species_id which tells me if its a dog or a cat. (1 = dog, 2 = cat)
Edit: Tagging parry2k