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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
KatchB
Regular Visitor

Distinct Count based on Multiple Conditions

KatchB_1-1692822368044.png

 

Hello I am trying to achieve a distinct count of Document # based on the column "Location Code". In this example the count should equal to 8. I am doing a distinct ct by the invoice number and the results are 1 but I can't figure out how to get it to calculate correctly. 

 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @KatchB ,

According to your description, you want to get the distinct count of location code, you can directly create a measure:

Measure = DISTINCTCOUNT([Location Code])

If you have more than one value in the Document No column, and you want to get the distinct count of Location Code by each Document No. Directly put Document No and Location Code in a visual and select "Count(Distinct)" of the Location Code column.

vyanjiangmsft_0-1692948151040.png

 

Best Regards,
Community Support Team _ kalyj

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

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @KatchB ,

According to your description, you want to get the distinct count of location code, you can directly create a measure:

Measure = DISTINCTCOUNT([Location Code])

If you have more than one value in the Document No column, and you want to get the distinct count of Location Code by each Document No. Directly put Document No and Location Code in a visual and select "Count(Distinct)" of the Location Code column.

vyanjiangmsft_0-1692948151040.png

 

Best Regards,
Community Support Team _ kalyj

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

mussaenda
Super User
Super User

Hi @KatchB ,

 

You can distinct count a combination of Document No and Location Code

 

The easiest way was to create a  Concatenantion of Document No and Location Code. Then do a distinctcount of that

JoeBarry
Solution Sage
Solution Sage

Hi @KatchB 

 

I will presume you want to dispay this number in a Table Visual?

 

we you're on the right track with your measure.

 

TotalDocNo= DISTINCTCOUNT(Table[Document No])

 

 

Then in the Table add the Location Code first and then the  new measure, then you will get the result you want

 

Thanks

Joe

 

If this post helps, then please Accept it as the solution 

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.

Top Solution Authors