Forum Discussion
kbol
6 years agoHelper I
Count on Dim Table Based on Fact Table Filtering
Hello, I've got a model like this: My goal is to count the number of rows in the Projects table that have at least 1 corresponding row in the StaffProj for a given selection of Staff. My a...
- 6 years ago
Hi kbol ,
You could try the following measure.
Projs With Selected Staff = CALCULATE ( DISTINCTCOUNT ( 'StaffProj'[Project] ), ALLSELECTED ( 'Staff'[Name] ) )Here is the test result.
Greg_Deckler
6 years agoCommunity Champion
Perhaps a column in Project table like:
Count = COUNTROWS(RELATEDTABLE('StaffProj')
Then you could create a measure:
Project Count = COUNTROWS(FILTER('Projects'),[Count] > 0)
- kbol6 years agoHelper I
Hi,
I'm afraid that Project column solution doesn't quite work because the filtering on Staff can change and the column is computed at refresh time, including all Staff. Thus with the above data is evaluates to 6 for every project, each having two associated staff.