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

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

Reply
unknown917
Helper III
Helper III

Calculate distinct count based on slicer selection in Power BI Desktop

Hello,

 

I have a table with Center #, Customer #, Year, Week #.  I am looking to create a measure that will count distinct customer numbers based on a slicer from another table which is filtered to a specific range of weeks.

 

For example, when weeks 1-4 are selected, the measure should calculate the distinct customers within that week range.  Caveat, customer numbers may appear multiple times either within the same week or across weeks.

 

@Anonymous  - was able to help a member in another post, but I believe this is somewhat different.  Any help would be appreciated!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @unknown917 ,

 

Based on your description, I've created some dummy data as well as metrics, check them out

If there's no relationship between tables. You can create the measure as

 

count distinct customer numbers = CALCULATE(DISTINCTCOUNT('Table'[Customer]),FILTER('Table',[Week] in ALLSELECTED('Table (2)'[Week])&&[Year] in ALLSELECTED('Table (2)'[Year])))

 

vstephenmsft_0-1721960899999.png

You can also download the attachment for more details.

If that's not the outcome you want, do what @ryan_mayu says, provide some dummy data along with the desired outcome.

 

Best Regards,

Stephen Tao

 

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

5 REPLIES 5
Anonymous
Not applicable

Hi @unknown917 ,

 

Could you please tell me if your problem has been solved?

If so, please accept the reply as solution, more people will benefit from it.

If not, please provide me with more details about your problem, thanks.

 

 

Best Regards,

Stephen Tao

 

Ashish_Mathur
Super User
Super User

Hi,

This simple measure should work

Customer count = distinctcount(Data[Customer #])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @unknown917 ,

 

Based on your description, I've created some dummy data as well as metrics, check them out

If there's no relationship between tables. You can create the measure as

 

count distinct customer numbers = CALCULATE(DISTINCTCOUNT('Table'[Customer]),FILTER('Table',[Week] in ALLSELECTED('Table (2)'[Week])&&[Year] in ALLSELECTED('Table (2)'[Year])))

 

vstephenmsft_0-1721960899999.png

You can also download the attachment for more details.

If that's not the outcome you want, do what @ryan_mayu says, provide some dummy data along with the desired outcome.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Thank you, @Anonymous 

ryan_mayu
Super User
Super User

could you pls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.