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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
RubySmith
Frequent Visitor

Table is not showing rows with count of 0 they are getting filtered out altogether

Hi, 

I'm very new to PowerBi and am experiencing the following issue

 

I have 2 tables. 
 
The first has a full list of Users and Licenses assigned. The second has a list of Purchase orders and Users that requested them. 
 
I have linked the tables by Users and Users (many to many). 
 
I have created a table visual where I want to show the full list of Users (filtered for Finance License) and the number of Purchase Orders (if any). 
 
The table is being filtered when I add Count of Purchase Orders, to show only the users that are in both tables (so removing any users that do not have Purchase Orders). In my example User 4 has no Purchase Orders and once I add the Count of PO to the visual, User 4 is dropped from the list. 
 
Seeking assistance to show all Users, and just the count of Purchase Orders either 0 or 1+. 
 
Thanks in advance!
 
Table 1
UserLicense
User 1Finance
User 1Sales
User 2Field Service
User 2Finance
User 2Customer Service
User 3Finance
User 3Sales
User 4Finance
User 5Finance
 
Table 2
Purchase OrderUser
PO1User 1
PO2User 1
PO3User 2
PO4User 2
PO5User 2
PO6User 3
PO7User 3
PO8User 5
PO9User 5

 

RubySmith_0-1734059040925.png

 

 

RubySmith_1-1734059092906.png

 

 

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

Hi @RubySmith  ,

As mentioned by @collinq     many to many relationships are generally avoided as much as possible and I have created a new table consisting of users and modified the relationship like this.

vnmadadimsft_0-1734075944842.png

Coming to your main issue, Power BI is filtering out user4 because they don’t have any purchase order, if you do want to see the visual count of 0 for user4 we have to use a Dax command

“CountQuantity =

COALESCE(COUNT(Sheet2[Purchase Order]), 0)

vnmadadimsft_1-1734075985544.png

 

With this method we will be able to view the count of user4. We can remove the count of purchase order from our columns but I have included it just to show the difference.

vnmadadimsft_2-1734075985544.png

 

 

Read more about coalesce here: COALESCE function (DAX) - DAX | Microsoft Learn

 

Please consider Accepting the solution if the provided answer meets your requirement so as to help other users or get back to us if you have further queries.



Thanks and Regards

View solution in original post

6 REPLIES 6
v-nmadadi-msft
Community Support
Community Support

Hi @RubySmith ,

We have not heard back from you if any of the answers has met your requirement kindly  Accept it as the solution  to help out other community members or get back to us with any other questions.
Thank you

Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1734250990133.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Bibiano_Geraldo
Super User
Super User

Hi @RubySmith ,

As mentioned by @v-nmadadi-msft , be aware always you can from many-to-many relationships.

 

For your scenario, you need to create a third table that will be related for table1 and table2 by this DAX:

Users = DISTINCT(UNION(VALUES(Table1[User]), VALUES(Table2[User])))

Above DAX will return This table:

Bibiano_Geraldo_0-1734186605546.png

Relate this table to both Table 1 and Table 2:

Bibiano_Geraldo_3-1734186984858.png

 

Now create a measure with the following DAX:

Count of Purchase Orders = 
CALCULATE(
    COALESCE(
        COUNT(Table2[Purchase Order]),
        0
    ),
    FILTER(
        Table1,
        Table1[License] = "Finance"
    )
)

 

Now create a Matrix visual, and drop the user column from the created users table in rows field, and on the values field add the created Count of Purchase Orders measure, and your Matrix will look like this:

Bibiano_Geraldo_2-1734186873763.png

 

 

 



v-nmadadi-msft
Community Support
Community Support

Hi @RubySmith  ,

As mentioned by @collinq     many to many relationships are generally avoided as much as possible and I have created a new table consisting of users and modified the relationship like this.

vnmadadimsft_0-1734075944842.png

Coming to your main issue, Power BI is filtering out user4 because they don’t have any purchase order, if you do want to see the visual count of 0 for user4 we have to use a Dax command

“CountQuantity =

COALESCE(COUNT(Sheet2[Purchase Order]), 0)

vnmadadimsft_1-1734075985544.png

 

With this method we will be able to view the count of user4. We can remove the count of purchase order from our columns but I have included it just to show the difference.

vnmadadimsft_2-1734075985544.png

 

 

Read more about coalesce here: COALESCE function (DAX) - DAX | Microsoft Learn

 

Please consider Accepting the solution if the provided answer meets your requirement so as to help other users or get back to us if you have further queries.



Thanks and Regards

Thanks that worked! appreciate your assistance 

collinq
Super User
Super User

Hi @RubySmith ,

 

While it is possible and sometimes necessary to have a many-to-many relationship this is not common and can cause it's own unique issues - including odd results like blanks (or zero) being removed.  Since you mentioned that you are new,  Iwould suggest some light reading (lol) in this article: Many-to-many relationship guidance - Power BI | Microsoft Learn

Particularly review the grain level issues where data can be "removed" or ignored or lost.

If there is any way to get around the many-to-many (like a bridge table) then I prefer that method.  Again, I understand in some cases there is no way around it but you have to be very careful about many-to-many relationships.

 




Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!
Private message me for consulting or training needs.




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.