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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.