cancel
Showing results for 
Search instead for 
Did you mean: 
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
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors