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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
dylanndengu
Helper I
Helper I

Make Customer Count Column using Distinct Values

Hi Everyone,

 

I am having a bit of trouble creating a customer count column based on the below information:

 

dylanndengu_0-1610013630070.png

 

Essentially, I would like a column where customer count is equal to 1 if the document number (last column) has a distinct number on a specific "report date" and "sold date". Please may someone assist.

 

Kind regards,

Dylan

1 ACCEPTED SOLUTION

Hi @dylanndengu ,

 

You can use the following measure :

 

Measure = SUMX(SUMMARIZE('Table','Table'[report date],'Table'[sold date],"countofcustomer",DISTINCTCOUNT('Table'[document])),[countofcustomer])

 

Sample data:

Capture.PNG

Result:

 

Capture2.PNG

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

 

Best Regards,

Dedmon Dai

 

View solution in original post

6 REPLIES 6
Tahreem24
Super User
Super User

@dylanndengu  Not really cleare. Based on my understanding you may create the below measure:

Measure = CALCULATE(DistinctCount(TableName[DocumentNumber]),ALLEXCEPT(TableName,TableName[ReportDate]))

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Apologies for the lack of clarity. The data I have takes into account everything a customer has bought on a specific day and assigns that transaction a number (documnetnr). The issue is if one customer buys a soda in addition to a bucket of chicken, those are recorded as 2 different transactions with the same document number. Hence, in order to calculate the actual number of customers, I need to only count distinct document numbers on a specific day, as the document numbers generated restart every 24 hours. I hope that clarifies things a bit.

Hi @dylanndengu ,

 

You can use the following measure :

 

Measure = SUMX(SUMMARIZE('Table','Table'[report date],'Table'[sold date],"countofcustomer",DISTINCTCOUNT('Table'[document])),[countofcustomer])

 

Sample data:

Capture.PNG

Result:

 

Capture2.PNG

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

 

Best Regards,

Dedmon Dai

 

This is great, thank you so much

amitchandak
Super User
Super User

@dylanndengu , nor very clear , Try measure like

 

Distinctcount(Table[documentnbr])

or

 

Countx(summarize(Table, Table[reportdate], table[soldate], "_1",Distinctcount(Table[documentnbr])),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit,

 

Thank you for responding but I do not thing the solution will work, and it is probably due to my lack of clarity.

 

The data I have takes into account everything a customer has bought on a specific day and assigns that transaction a number (documnetnr). The issue is if one customer buys a soda in addition to a bucket of chicken, those are recorded as 2 different transactions with the same document number. Hence, in order to calculate the actual number of customers, I need to only count distinct document numbers on a specific day, as the document numbers generated restart every 24 hours. So you can't simply take a distinct count of the document numbers because new ones are generated every day. I'm thinking I could perhaps group by report date, sold date and document number and then do a distinct count on that? Please let me know what you think. I hope that clarifies things a bit.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.