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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
manoj_0911
Helper V
Helper V

Incorrect Count Distinct in Table and Visualization

I am facing an issue where the *Count Distinct* for a field (`Connected`) is incorrect in visualizations like tables and decomposition trees. For example, for `Division Name: Bangalore`, the database shows a distinct count of `Connected` as **296**, but Power BI displays a higher value.

 

The `Offered` field, on the other hand, displays the correct sum in all visualizations. This inconsistency seems specific to the `Connected` field.

 

Steps Taken:
1. Verified the data in the database, confirming the correct distinct count for `Connected`.
2. Cross-checked with other fields like `Offered`, which are accurate in Power BI visualizations.
3. Tested in different visuals (Table, Decomposition Tree, etc.), but the issue persists.

 

Attachments:
- Sample Data in Excel
- `.pbix` file for replication

 

https://docs.google.com/spreadsheets/d/1u5JUN4NtL2L-odbmocS6WPJM8fmb4g9w/edit?usp=sharing&ouid=10765...


https://drive.google.com/file/d/1gdRJV6-MuT-giv4HitPlOzp0ZSKg-g7q/view?usp=sharing

manoj_0911_0-1734086745695.png

 

Expected Behavior:
The `Count Distinct` for the `Connected` field should align with the database values and match across visuals.

 

Environment Details:
- Data Source: [SQL Server]

 

I would appreciate it if the community could provide insights or solutions to resolve this issue.

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

There are null values (blanks) in the data so technically the result looks correct but not what you want.

I think you can use DISTINCTCOUNTNOBLANK in a measure for this.

Use +0 if you want to force a 0 result when it would otherwise be blank

View solution in original post

4 REPLIES 4
HotChilli
Super User
Super User

There are null values (blanks) in the data so technically the result looks correct but not what you want.

I think you can use DISTINCTCOUNTNOBLANK in a measure for this.

Use +0 if you want to force a 0 result when it would otherwise be blank

Thank you so much for helping me fix this.

manoj_0911
Helper V
Helper V

The total for the Connected field in the visual seems to be inaccurate. Based on the database query results, DNIS ending with 555 has 295 calls in the database. The other DNIS values shown in Power BI are showing as 0 in the database. Additionally, an extra record appears in Power BI. I have attached the database query results for reference to assist in troubleshooting

manoj_0911_1-1734092577421.png

 

HotChilli
Super User
Super User

"Expected Behavior:
The `Count Distinct` for the `Connected` field should align with the database values and match across visuals." - that's a little bit obscure.

Do you mean "the total is not right" for that visual? Is it supposed to be 306 for this visual?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.