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
sanjanarama
Resolver I
Resolver I

Display parent & child record if child is selected

Here is my Data

ID Parent ID Type Assigned
1 5 Type1 PersonA
2 6 Type1 PersonB
3 7 Type1 PersonC
4 1 Type2 PersonB
5 2 Type2 Person A
6 3 Type2 PersonD
7 2 Type3 PersonC
8 1 Type3 PersonB
9 3 Type3 PersonA

 

Desired Result - If ID - 6 is selected from the Filter, then display the following

ID Parent ID Type Assigned
6 3 Type2 PersonD
9 3 Type3 PersonA



Desired Result - If ID - 7 is selected from the Filter, then display the following

ID Parent ID Type Assigned
5 2 Type2 Person A
7 2 Type3 PersonC


I refered blog - mentioned below but solution is not apt

Solved: Re: Display Parent and All Child Records when Valu... - Microsoft Power BI Community

1 ACCEPTED SOLUTION

Hi @sanjanarama ,

It require one ID dimension table which there is no relationship with your fact table... Assume that there is one ID dimension table in your SSAS cube, you can follow the steps below to get it:

1. Use the ID field of ID dimension table as slicer 

yingyinr_0-1661160954249.png

2. Create a measure as below to filter the data on the visual

Flag = 
VAR _selids =
    ALLSELECTED ( 'ID Dimension'[ID] )
VAR _selpid =
    SELECTEDVALUE ( 'Table'[Parent ID] )
VAR _pids =
    CALCULATETABLE (
        VALUES ( 'Table'[Parent ID] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[ID] IN _selids )
    )
RETURN
    IF ( _selpid IN _pids, 1, 0 )

yingyinr_1-1661161024242.png

Best Regards

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

View solution in original post

5 REPLIES 5
PijushRoy
Super User
Super User

Hi @sanjanarama 

Please create summary table

Child & Parent ID = SUMMARIZECOLUMNS('Table (2)'[ID],'Table (2)'[Parent ID])

01.JPG

 

Create a measure

Measure = IF(
MAX('Table (2)'[Parent ID])=MAX('Child & Parent ID'[Parent ID]),
1,
0)

011.JPG

 

Apply the created mesure filter in Table visual and it is done
0111.JPG

 

Please find the attached pbix file 

 

If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos

how can we achive this in direct mode?

SUMMARIZECOLUMNS and MEASURE dax should working in direct mode
If it is not working, please let me know

thank you, 
my report is currently connecting SSAS cube with Live mode. so i dont have option to create new table

Hi @sanjanarama ,

It require one ID dimension table which there is no relationship with your fact table... Assume that there is one ID dimension table in your SSAS cube, you can follow the steps below to get it:

1. Use the ID field of ID dimension table as slicer 

yingyinr_0-1661160954249.png

2. Create a measure as below to filter the data on the visual

Flag = 
VAR _selids =
    ALLSELECTED ( 'ID Dimension'[ID] )
VAR _selpid =
    SELECTEDVALUE ( 'Table'[Parent ID] )
VAR _pids =
    CALCULATETABLE (
        VALUES ( 'Table'[Parent ID] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[ID] IN _selids )
    )
RETURN
    IF ( _selpid IN _pids, 1, 0 )

yingyinr_1-1661161024242.png

Best Regards

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

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.