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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NoobAnalyst01
Helper I
Helper I

How to count number of non-null record from another table

Hello,

 

I have two tables,  table A and Tablt B, join by truck number, it is a one to many relationship

 

 A:

Truck Number # Checks# Dispatch
100112

B:

Truck NumberChekin TimeDispach Time
10011:309:00
1001 9:00

 

 

Idally, it will give the 2 in diaptach column in table A(even if the record in table B, it is the same tim), and give me 1 times for chckin in time, because there is null record in table B. curretly i am using the following formula, but it gives both for 2. does anyone know I can I make it not count this blank record, and still count 2 for even I have the same dispatch time.

 

DISPATCHS = IF(ISBLANK( COUNT(DISPATCH[DISPATCH_TIME])),0,COUNT(DISPATCH[DISPATCH_TIME]))

 

Thanks

Frank

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @NoobAnalyst01,

 

How are you setting up the visuals? I have made a mockup of your information and just by choosing count on the dispatch and check in it gives me 2 and 1.

 

count.gif

 

Not really sure what you want to achieve, can you please ellaborate better and give a more extendend sample data and expected result.

 

Normally blanks or null aren't consider in the count and sum.

 

Regards,

MFelix

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @NoobAnalyst01,

 

In TableA, please create below calculated columns:

# Checks =
CALCULATE (
    COUNTROWS ( FILTER ( TableB, TableB[Chekin Time] <> BLANK () ) ),
    USERELATIONSHIP ( TableA[Truck Number], TableB[Truck Number] )
)

# Dispatch =
CALCULATE (
    COUNT ( TableB[Dispach Time] ),
    ALLEXCEPT ( TableA, TableA[Truck Number] )
)

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MFelix
Super User
Super User

Hi @NoobAnalyst01,

 

How are you setting up the visuals? I have made a mockup of your information and just by choosing count on the dispatch and check in it gives me 2 and 1.

 

count.gif

 

Not really sure what you want to achieve, can you please ellaborate better and give a more extendend sample data and expected result.

 

Normally blanks or null aren't consider in the count and sum.

 

Regards,

MFelix

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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