Forum Discussion
Count DAX
- 5 years ago
Anonymous
please try to create a measure
Measure = CALCULATE(DISTINCTCOUNT('Table'[Project Sub ID]),FILTER(all('Table'),'Table'[Project ID]=max('Table'[Project ID])))pls see the attachment below
Thank you for your response, sorry I should have clarified more. What I am trying to do is to count the number of subcategories in each project ID and assign that value to each Sub ID. 100 has 2 distinct categories (102A and 102B), so both 102A and 102B will have 2 as value. 103 has 3 distinct categories (103A, 103B, 103C) so 103A, 103B, 103C will have the 3 as value.
Anonymous
please try to create a measure
Measure = CALCULATE(DISTINCTCOUNT('Table'[Project Sub ID]),FILTER(all('Table'),'Table'[Project ID]=max('Table'[Project ID])))
pls see the attachment below
- Anonymous5 years agoNot applicable
Thank you so much for help! Could you also provide me the explaination of how the measure above works so I could use it as a future reference?
- ryan_mayu5 years agoSuper User
Anonymous
Measure = CALCULATE(DISTINCTCOUNT('Table'[Project Sub ID]),FILTER(all('Table'),'Table'[Project ID]=max('Table'[Project ID])))
if we have subject ID, then we can get the corresponding project ID.
FILTER(all table)- remove filters to search the whole table.
then search the project IDs which are the same as the current one.
max or min will return the current project ID