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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

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
Community Champion
Community Champion

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
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.