Forum Discussion
Filter Context / Transition Help
- 4 years ago
Hi Badger43
The measure you have written is one version of a related distinct count measure.
See here for a similar example:
https://www.daxpatterns.com/related-distinct-count-excel-2013/
The important concept here is "expanded tables". Providing Expense as a filter argument actually adds the expanded Expense table as a filter, which includes columns of all tables on the 1-side of a relationship with Expense, so includes all columns of Accounts.
The result is that rows of Accounts related to the visible rows of Expense become filters, and [NoofAccounts] gives the expected result.
This is a good article on expanded tables:https://www.sqlbi.com/articles/expanded-tables-in-dax/
Regards,
Owen
Hi Badger43
The measure you have written is one version of a related distinct count measure.
See here for a similar example:
https://www.daxpatterns.com/related-distinct-count-excel-2013/
The important concept here is "expanded tables". Providing Expense as a filter argument actually adds the expanded Expense table as a filter, which includes columns of all tables on the 1-side of a relationship with Expense, so includes all columns of Accounts.
The result is that rows of Accounts related to the visible rows of Expense become filters, and [NoofAccounts] gives the expected result.
This is a good article on expanded tables:
https://www.sqlbi.com/articles/expanded-tables-in-dax/
Regards,
Owen