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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Count Number of Users Who Has At Least One Occurence

Hi everyone,

 

I am new to Power BI and DAX.  I have a table that has three columns, namely User_ID, Visit_ID, and Visit_Exposed. I want to :

 

1. Calculate the number of users (unique User_ID) who have at least one visit considered as exposed ;

2. Calculate the percentage of users who have at least one visit considered as exposed ( Users With At Least One Visit Considered As Exposed / All Users * 100 ).

 

In this situation, the number of users is the number of unique User_ID (one user = one User_ID), and the number of visits equals the number of unique Visit_ID (one visit = one Visit_ID).

 

Please let me know if I need to edit this post or post clarification. 

 

Thank you for your help,

 

Kathia

 

ExampleExample

1 ACCEPTED SOLUTION
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to below measures:

Distinctcount = DISTINCTCOUNT(Table1[User_ID])
Percentage = DIVIDE(CALCULATE(COUNT(Table1[Visit_Exposed]),FILTER(ALL('Table1'),'Table1'[Visit_Exposed]<>0)),CALCULATE(DISTINCTCOUNT(Table1[Visit_ID]),ALL(Table1)))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to below measures:

Distinctcount = DISTINCTCOUNT(Table1[User_ID])
Percentage = DIVIDE(CALCULATE(COUNT(Table1[Visit_Exposed]),FILTER(ALL('Table1'),'Table1'[Visit_Exposed]<>0)),CALCULATE(DISTINCTCOUNT(Table1[Visit_ID]),ALL(Table1)))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

What you need to do is the following.

 

1. Create a measure with this DAX:

    Number of users exposed = CALCULATE(DISTINCTCOUNT(Table1[user_id]);Table1[visit_exposed] = 1)

 

2. First create a new measure as the quantity of users:

    Number of users = DISTINCTCOUNT(Table1[user_id])

    Then, create a percentage measure as:

    Percentage = DIVIDE([Number of users exposed]; [Number of users])

    Last, mark the Percentage measure as Percentage in the Modeling tab.

 

Hope this helps.

 

Regards.

HotChilli
Super User
Super User

For part 1, you could filter the table to give you only rows that have exposed equal to 1. 

Then put the distinct count of the user_id on a card.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.