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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Filter for NULL values on merged table with DAX

Hi all,

 

I am working from a database connected to PowerBI via Connect Live, therefore I am limited on the amount of data transformation I can do. I can only use measures, as columns and power query are disabled.

 

I have two tables (A and C), which are connected via a third table (B), and I would like to create a filter and count of an attribute in table C when an attribute in table A (Email) is NOT NULL.

 

TABLE A

TABLE B

TABLE C

First Name

Email (link to table A)

Unique ref. (link to table B)

Last Name

Building

SystemId

Email (link to table B)

Unique ref. (link to table C)

Software

 

In SQL, I have created a left join between the three tables, so that I have a list of all the email addresses in table A. Some of them correspond to a NULL SystemId in table C. I can see this easily if I create a table in PowerBI with the two columns Email and SystemId:

 

Email (table A)

SystemId (table C)

Example1

1234

Example2

[NULL]

Example3

2345

 

  1. How can I get the count of NULL entries in C that correspond to Email addresses in table A (i.e. where email address in table A is NOT NULL)?
  2. Also, how can I create a filter to the table in PowerBI so that the final users can filter themselves for a list that shows only rows for NULL or NOT NULL SystemId?

 

Many thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous  ,

According to your description, I have created three tables of ABC, which are left related to form the following table:

v-yangliu-msft_0-1609995782546.png

Here are the steps you can follow:

1. Get the count of NULL entries.

 

Create measure:
get the count of NULL entries =
CALCULATE(COUNTROWS('MergeA-B-C'),FILTER('MergeA-B-C','MergeA-B-C'[TableC.Systemid]=BLANK()))

 

Result:

v-yangliu-msft_1-1609995782549.jpeg

2. list that shows only rows for NULL or NOT NULL SystemId

Create calculated column:

 

Column1 =
IF('MergeA-B-C'[TableC.Systemid]=BLANK(),"Null","Not Null")

 

Put the column1 into the slice to filter

Result:

v-yangliu-msft_2-1609995782551.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

5 REPLIES 5
Anonymous
Not applicable

Hi  @Anonymous  ,

According to your description, I have created three tables of ABC, which are left related to form the following table:

v-yangliu-msft_0-1609995782546.png

Here are the steps you can follow:

1. Get the count of NULL entries.

 

Create measure:
get the count of NULL entries =
CALCULATE(COUNTROWS('MergeA-B-C'),FILTER('MergeA-B-C','MergeA-B-C'[TableC.Systemid]=BLANK()))

 

Result:

v-yangliu-msft_1-1609995782549.jpeg

2. list that shows only rows for NULL or NOT NULL SystemId

Create calculated column:

 

Column1 =
IF('MergeA-B-C'[TableC.Systemid]=BLANK(),"Null","Not Null")

 

Put the column1 into the slice to filter

Result:

v-yangliu-msft_2-1609995782551.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Try measure like

 

countx(values(Table[Email]), isblank(TableC[SystemId]))

 

or


countx(filter(values(Table[Email]), isblank(calculate(count(TableC[SystemId])))),[Email])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks @amitchandak

I tried the two formulas. Unfortunately I get an error back as PowerBI says COUNTX() doesn't work with values of type Boolean (such as ISBLANK() ).

Also, in your formulas you use "Table", e.g. countx(values(Table[Email]), isblank(TableC[SystemId])). Do you mean "Table A"?

Thanks!

amitchandak
Super User
Super User

@Anonymous , Try countblank

Try a measure like

countblank(TableC[SystemID])

 

https://docs.microsoft.com/en-us/dax/countblank-function-dax

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak,

 

The countblank on table C doesn't give me what I need because there are no NULL in table C.

When I do a left merge though, since I have more emails in table A than systemId in table C, some emails are not linked to any systemId and I need to get the count of the rows where SystemId is NULL (but email is not).

 

Any ideas??

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.