filter direction
1 TopicCounting 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 suppliers ('Fornitori intestatari') and the fact table of the purchases ('Acquisti') is set as a standard one-way filter direction, one-to-many: I was pretty sure that a dax formula like this one was necessary, levereging a CROSSFILTER() function or similar to obtain the distinct count of suppliers, filtered by the purchases fact table: Fornitori con fatturato = VAR DatiFatturato = CALCULATETABLE('Acquisti';'Acquisti'[Flag fatturato]=1) RETURN COUNTROWS( CALCULATETABLE ( VALUES('Fornitori intestatari'[Fornitore - Descrizione]); DatiFatturato; CROSSFILTER ('Acquisti'[K_CodCli]; 'Fornitori intestatari'[K_CodCli]; BOTH) )) and it works, indeed. What I can't explain to myself is that this ultra simplified version of the expression seems to be working fine, as well: Fornitori con fatturato = VAR DatiFatturato = CALCULATETABLE('Acquisti';'Acquisti'[Flag fatturato]=1) RETURN CALCULATE(DISTINCTCOUNT('Fornitori intestatari'[Fornitore - Descrizione]); DatiFatturato) Can anyone explain me why? My hypothesis is that the DISTINCTCOUNT is working on what here (https://www.sqlbi.com/articles/expanded-tables-in-dax/) is called 'the expanded version' of the fact table 'Acquisti', instead of the 'physical' dimension table 'Fornitori intestatari', that is to say a sort of SELECT * FROM 'Aquisti' LEFT JOIN 'Fornitori intestatari', if I correctly understood. If so, is this syntax safe, or is the first one better? Thanks!Solved9.9KViews0likes15Comments