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
michael_ma
Frequent Visitor

DistinctCount function counting values greater than 1 despite removing all duplicates in Power Query

Hi everyone, 

 

In power query I transformed a column by removing all the duplicates so that each value in the column will be distinct from one another. 

michael_ma_0-1697757391636.png

However, when I do a count of the column in a report, I'm receivng values from the column that have a count greater than 1.

michael_ma_1-1697757607287.png

The total is the correct value that I'm looking for, but confused on why there are counts greater than 1. When I query a distinct count in our source system I get the same total as the visual above, but when I query a distinct count in power bi I get a lower total value than what I expect. 

 

Does anyone know why there are counts greater than 1 despite removing all duplicates in power query? Is there a dax expression that can do a distinct count and reflect the same total as shown above? 

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @michael_ma 

As a hunch, I would suggest you look into whether this is a case-sensitivity issue.

 

Power Query is case sensitive when comparing strings so, when removing duplicates, values that differ only in case will not be treated as equal.

 

However, after loading tables to the data model, strings are case insensitive, and only one representative instance of each string will be loaded in a given column. Trailing spaces are also removed from all string alues.

 

I have attached a small example:

3 distinct values in Name column in Power Query:

OwenAuger_0-1697795472728.png

One distinct value after loading:

OwenAuger_1-1697795534976.png

 

A couple of articles to refer to:

https://www.sqlbi.com/articles/letter-case-sensitivity-in-dax-power-bi-and-analysis-services

https://blog.crossjoin.co.uk/2019/10/06/power-bi-and-case-sensitivity/

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

1 REPLY 1
OwenAuger
Super User
Super User

Hi @michael_ma 

As a hunch, I would suggest you look into whether this is a case-sensitivity issue.

 

Power Query is case sensitive when comparing strings so, when removing duplicates, values that differ only in case will not be treated as equal.

 

However, after loading tables to the data model, strings are case insensitive, and only one representative instance of each string will be loaded in a given column. Trailing spaces are also removed from all string alues.

 

I have attached a small example:

3 distinct values in Name column in Power Query:

OwenAuger_0-1697795472728.png

One distinct value after loading:

OwenAuger_1-1697795534976.png

 

A couple of articles to refer to:

https://www.sqlbi.com/articles/letter-case-sensitivity-in-dax-power-bi-and-analysis-services

https://blog.crossjoin.co.uk/2019/10/06/power-bi-and-case-sensitivity/

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

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.