Forum Discussion
Distinct count for every customer row
- 5 years ago
Hi Anonymous
I've created the measure but please remember next time not to change the names of the fields in the visual as this makes it really much harder to work with the model for a person that has not worked with the model. Nobody wants to spend time on deciphering step by step, painstakingly, which field belongs to which table.
Here's the measure but I can't guarantee it'll be fast:
The Count = var vCurrentSubjectID = DISTINCT( 'D - Subject'[Subject ID] ) var vResult = if( NOT ISEMPTY( 'F - Sales packing slip' ), CALCULATE( DISTINCTCOUNT( 'F - Sales packing slip'[Packing slip ID] ), 'D - Subject'[Subject ID] in vCurrentSubjectID, ALLSELECTED( 'F - Sales packing slip' ) ) ) return vResult
Anonymous
Well, I gave you an idea (I don't know the layout of your model and if I don't, then I can't guarantee 100% correctness of my solution, obviously)... You should have built on this. But I'll do it for you. Instead of COUNTROWS( FactTable ) use DISTINCTCOUNT( FactTable[Documento di transporto] ).
- Anonymous5 years agoNot applicable
Anonymous
Yes, thanks, I appreciate your help. Unfortunately I've already tried and the result is the same as the measure we tried before. I cannot do removefilters on a field while I'm doing a distinctcount on that field and displaying it on the visual:
I imagine there's no solution for that. That's not a trivial problem that can be resolve with a simple formula.