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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
EaglesTony
Helper V
Helper V

Help with Parent Child group by on conditions of another tab;e

Hi,

 

  I have a table1 as follows:

 

Issue   ChildKey     Component

1578   1000           On-Hold

1578   1001           On-Hold

1579    2000          Q4

1579    2001          Q4

2173    <null>       On-Hold

2173    <null>       Q4

 

What I want is the result of :

 

Issue   ChildKey     ParentOnHold       ParentQ4

1578   1000            Y                            N

1578   1001           Y                             N

1579    2000          N                            Y

1579    2001          N                            Y

2173    <null>       Y                             Y

2173    <null>       Y                             Y

 

 

Thanks

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @EaglesTony ,

 

Please try code as below to create calculated columns.

ParentOnHold = 
VAR _ComponentbyIssue = CALCULATETABLE(VALUES('Table'[Component]),ALLEXCEPT('Table','Table'[Issue]))
RETURN
IF("On-Hold" in _ComponentbyIssue,"Y","N")
ParentQ4 = 
VAR _ComponentbyIssue = CALCULATETABLE(VALUES('Table'[Component]),ALLEXCEPT('Table','Table'[Issue]))
RETURN
IF("Q4" in _ComponentbyIssue,"Y","N")

Result is as below.

vrzhoumsft_0-1697097752451.png

 

Best Regards,
Rico Zhou

 

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

6 REPLIES 6
v-rzhou-msft
Community Support
Community Support

Hi @EaglesTony ,

 

Please try code as below to create calculated columns.

ParentOnHold = 
VAR _ComponentbyIssue = CALCULATETABLE(VALUES('Table'[Component]),ALLEXCEPT('Table','Table'[Issue]))
RETURN
IF("On-Hold" in _ComponentbyIssue,"Y","N")
ParentQ4 = 
VAR _ComponentbyIssue = CALCULATETABLE(VALUES('Table'[Component]),ALLEXCEPT('Table','Table'[Issue]))
RETURN
IF("Q4" in _ComponentbyIssue,"Y","N")

Result is as below.

vrzhoumsft_0-1697097752451.png

 

Best Regards,
Rico Zhou

 

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

mickey64
Super User
Super User

For your reference.

 

Step 1: I add two caliculated columns to the table and make a matrix.

    ParentOnHold = IF([ChildKey] = BLANK(),"Y",IF([Component] = "On-Hold","Y","N"))

    ParentQ4 = IF([ChildKey] = BLANK(),"Y",IF([Component] = "Q4","Y","N"))

 

Step 2: I make an new table.

mickey64_0-1696951683766.png

 

I'm not sure that will work, as it will create 2 columns for each record so 

 

Issue    ChildKey    ParentOnHold    ParentQ4

2173    <null>       Y                         N

2173   <null>        N                        Y

 

Since both these records have the same parent and both On-Hold and Q4, I want both records to represent

this as follows:

 

Issue    ChildKey    ParentOnHold    ParentQ4

2173    <null>       Y                         Y

2173   <null>        Y                        Y

 

 

I have corrected my previous post.

Looks like that worked, now I just need to get more columns from the Parent table in my Table that has Issue, ChildKey,ParentOnHold,ParentQ4..I'm thinking I can merge the two.

I think you can simply add some calculated columns to the table1.

 

mickey64_0-1696953499324.png

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.