Forum Discussion
91asma2
5 years agoHelper I
Distinct Count Two Measures
- Anonymous5 years ago
Here's what the measures should look like:
[Follow up] = COUNTROWS( FILTER( VALUES( Assessment[User ID] ), CALCULATE( DISTINCTCOUNT( Assessment[assessment_id] ) >= 2 ) ) ) [Total Users Training] = CALCULATE( DISTINCTCOUNT( 'Sessions'[User ID] ), KEEPFILTERS( 'Sessions'[Event Category] = "Training" ) ) [Users in Both] = var FollowUpUsers = FILTER( VALUES( Assessment[User ID] ), CALCULATE( DISTINCTCOUNT( Assessment[assessment_id] ) >= 2 ) ) var TotalUsersTrainingUsers = CALCULATETABLE( DISTINCT( 'Sessions'[User ID] ), KEEPFILTERS( 'Sessions'[Event Category] = "Training" ) ) var Result = COUNTROWS( INTERSECT( FollowUpUsers, TotalUsersTrainingUsers ) ) RETURN Result
Anonymous
5 years agoNot applicable
Your model might be correct but I really suspect it's sub-optimal. Is your model a star-schema with conformed dimensions?
By the way, your problem with that much information is not solvable right now. You have to show us the measures, (ideally) the model and what it means "to count the useres that exist in both measures." One can't write DAX in a vacuum...
91asma2
5 years agoHelper I
Hi daxer,
Yes, my model is a star schema.
- Anonymous5 years agoNot applicable
Here's what the measures should look like:
[Follow up] = COUNTROWS( FILTER( VALUES( Assessment[User ID] ), CALCULATE( DISTINCTCOUNT( Assessment[assessment_id] ) >= 2 ) ) ) [Total Users Training] = CALCULATE( DISTINCTCOUNT( 'Sessions'[User ID] ), KEEPFILTERS( 'Sessions'[Event Category] = "Training" ) ) [Users in Both] = var FollowUpUsers = FILTER( VALUES( Assessment[User ID] ), CALCULATE( DISTINCTCOUNT( Assessment[assessment_id] ) >= 2 ) ) var TotalUsersTrainingUsers = CALCULATETABLE( DISTINCT( 'Sessions'[User ID] ), KEEPFILTERS( 'Sessions'[Event Category] = "Training" ) ) var Result = COUNTROWS( INTERSECT( FollowUpUsers, TotalUsersTrainingUsers ) ) RETURN Result - Anonymous5 years agoNot applicable
- 91asma25 years agoHelper I
This works! Thanks a lot Anonymous !
and yes I do have a separate dimension for users.