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
pjpreddy2
Frequent Visitor

Two Tables, Nothing but Zeros

Hi All,

 

I've been staring at this issue and need a second set of eyes.  I've got two tables, TABLE1 a parent table with unique values and TABLE2 with values I need to slice and work with.  What I'm trying to do is have a list of locations (sorted by parent location) that have no values in Table 2.  I've tried a few things but can't get it to work. 

 

Table 1
Parent#Parent NameLoc#Location Name
29Pittsburgh9929Region LDR
29Pittsburgh2980Murrysville
29Pittsburgh2979Wexford Flats
28Ohio2890Cedar Cliff
28Ohio2889Carlisle
28Ohio2888Simpson Ferry
28Ohio2887Hampden Center
28Ohio2886Lemoyne
28Ohio2885Coventry Mall
32Virgina2830Westlake
32Virgina2829Hudson
31Maryland2761Catonsville
31Maryland2760Carney
31Maryland2759Lombard Street
31Maryland2758Waugh Chapel
31Maryland2757Annapolis Towne Centre
31Maryland2755Baywoods

 

Table 2
Parent#Parent NameLoc#Location NameValue
29Pittsburgh9929Region LDR123698
29Pittsburgh2980Murrysville5555
28Ohio2888Simpson Ferry2000
28Ohio2887Hampden Center400
32Virgina2830Westlake398
31Maryland2759Lombard Street33558
32Virgina2830Westlake350
31Maryland2759Lombard Street4000
29Pittsburgh9929Region LDR200
29Pittsburgh2980Murrysville1000
28Ohio2888Simpson Ferry40
28Ohio2888Simpson Ferry100

 

I've tried

 

Zero's = IF(Table 2[Value]=0,"zero","Not Zero")

 

As a calculation but it's not returning the correct answer. 

 

Thanks Everyone!

4 REPLIES 4
Anonymous
Not applicable

We can also achieve this by leveraging RELATEDTABLE. Create a calculated column using

No Record's = COUNTROWS(RELATEDTABLE(Table 2[Value])) and then filter "No Record's" = Blank or 0 to display the records with no values in Table 2.

 

Please let me know if this worked.

 

@Greg_Deckler: Huge fan of yours and I started following the Power BI community because of your answers. You are a great asset to the PBI community. Thanks for all your tips and answers. 

Greg_Deckler
Super User
Super User

I believe what you want for your calculation (in a calculated column in Table1) would be:

 

Zero's = IF(ISBLANK(CALCULATE(SUM(Table 2[Value]))),"zero","Not Zero")

Assuming you have a relationship on "#Loc" columns.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
alexei7
Continued Contributor
Continued Contributor

Hi,

 

Presuming that you've joined both table by the "Loc#" field, you could just bring in "Loc#" from the parent table and "location name" from the location table into a Power BI table visual and then filter the visual to only show where "location name" is blank.

No that is not working (that was the first thing I did), I'm using the locations from the Table 1 and trying to tie the values into Table 2, but you're seeing a simplified version of the data.  There's a lot more complexity here that is likely causing the problem, but I've sort of stared at this for so long I can't see the answer. 

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.