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
socksinbox
Helper I
Helper I

Get only parents who has children record

Hi there,

 

I have a table which has records with parent/child relationship. Some records has parent id defined in the parentid column which itself a record in the table

 

e.g. 

 

Name  | Parent

rec1  |
rec2  | rec1

etc

 

The scope is to show records which has any child record.


Can you please help and let me know the easiest way to achieve this?

 

The final design is to show a table with all records and toggle button to let them switch from all records and records with a childern 

 

cheers

 

2 REPLIES 2
Anonymous
Not applicable

You want a calculated column in your table of records that will say TRUE if the record has a child (you can then create a slicer out of this column's values). Here's the formula:

 

[Has Child Records] = -- calculated column
var __parent = T[Name]
var __hasChildren =
	NOT ISEMPTY(
		FILTER(
			T,
			T[Parent] = __parent
		)
	)
RETURN
	__hasChildren

Best

Darek

This works. Thanks a lot

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.

Top Solution Authors