Forum Discussion
Anonymous
6 years agoNot applicable
Counting dimension's attribute distinct values
Hi guys, I need your help. I have to count the distinct suppliers from witch I made at least a purchase, given a certain filter context. Since the relationship between the dimension table of the su...
- 6 years ago
Hi guys,
The expanded version of Acquisti actually contains the full Fornitori table.
Therefore, if you use Acquisti as a filter argument in CALCULATE, you are filtering Fornitori too. CROSSFILTER is useless in this case. You could obtain the same performing a DISTINCTCOUNT, use CROSSFILTER avoiding the variable at all.
With that said, I would use something easier to read, like:
COUNTROWS ( SUMMARIZE ( Acquisti, Fornitori[Fornitore - Descrizione] ) )
Did not check performance, but it shouldn't be too bad, and definitely easier to read.
Anonymous
6 years agoNot applicable
It's rather simple. When you do distinctcount( Fact[DimKey] ), you are just calculating the number of different DimKey's in your fact table in the rows that are visible in the current context. No magic. This simple measure applied to your model does exactly what you want:
I have to count the distinct suppliers from witch I made at least a purchase, given a certain filter context.
Best
D
I have to count the distinct suppliers from witch I made at least a purchase, given a certain filter context.
Best
D
- Anonymous6 years agoNot applicable
I'm not. I'm doing DISTINCTCOUNT( Dimension[DimAttribute] ), over a single-way relationship, and it's working the same as the CROSSFILTER() version of the formula.
- Anonymous6 years agoNot applicableIn this case (which I missed) expanded tables are at work.
Best
D- Anonymous6 years agoNot applicableBut you should not use this technique as it can be slow and resource intensive. Use what I did above.
Best
D