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

View all the Fabric Data Days sessions on demand. View schedule

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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.