Forum Discussion
shoemaker27
3 years agoFrequent Visitor
Count Distinct Measure at lowest level
Hi!, Im struggling with this measure, Im not getting the result I want, I have this table: sale_id sale_type person 1 1 a 2 1 b 3 2 c 4 2 x 5 2 y 6 2 z 7 3 a ...
- 3 years ago
Hi shoemaker27
Pleas tryDistinct_Person_Per_Sale_Type = COUNTROWS ( CALCULATETABLE ( VALUES ( 'Table'[person] ), ALL ( 'Table' ), -- can use ALLEXCEPT and include filter safe columns if any VALUES ( 'Table'[sale_type] ) ) ) - 3 years ago
Please try
Distinct_Person_Per_Sale_Type =
COUNTROWS (
CALCULATETABLE (
VALUES ( 'Table'[person] ),
ALLSELECTED ( 'Table' ),
VALUES ( 'Table'[sale_type] )
)
)
shoemaker27
3 years agoFrequent Visitor
The model is like this:
tamerj1
3 years agoCommunity Champion
Please try
Distinct_Person_Per_Sale_Type =
COUNTROWS (
CALCULATETABLE (
VALUES ( 'Table'[person] ),
ALLSELECTED ( 'Table' ),
VALUES ( 'Table'[sale_type] )
)
)
- shoemaker273 years agoFrequent Visitor
Awesome!! thanks!!!
Still trying to understand how works the filter VALUES ( 'Table'[sale_type] ) on the context.
- tamerj13 years agoCommunity Champion
shoemaker27
ALLSELECTED removes all inner filters imposed byu the visual itself but keeps the outer filters imposed by slicers, page filters and visual level filters. VALUES restores the filter of sales_type