Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
91asma2
Helper I
Helper I

Distinct Count Two Measures

 
1 ACCEPTED SOLUTION
Anonymous
Not 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

 

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Can you please mark the answer as the solution? This helps me and others who will be looking for something smilar... Thanks.

Anonymous
Not applicable

... which means your model is sub-optimal, to say the least. Your Users should exist in a dimensions of their own and be connected to both fact tables. Then it'll be DEAD EASY to do what you want. Please make your model correct first. If you want to know what it means you can read this:

 

Understand star schema and the importance for Power BI - Power BI | Microsoft Docs

Thank you, the article is helpful. But my model is correct and I know it easy but I am not sure how to approach it. What is your recommendation? 

Anonymous
Not applicable

@91asma2 

 

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...

Hi daxer, 

Yes, my model is a star schema.  

 
Anonymous
Not 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

 

Anonymous
Not applicable

@91asma2 

 

Do you have a separate dimension for your users?

This works! Thanks a lot @Anonymous !

and yes I do have a separate dimension for users. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.