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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ErPat
Frequent Visitor

Parent-child relationship based on conditions

I am new to Power BI and just learning on my own.  Is it possible to assign rows based on another column aside from the parent-child relationship?

Here is an example of what I want to achieve:

ErPat_0-1714665881371.png

 

Always assign the row (whether Parent or Item) to the owner of an Item task with a Work Type = "Dev".  If there is no Dev work type (ex. Item id = "4"), assign it to the owner with a Work Type = "QA".

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

Hi @ErPat 

I found that based on your requirement, the assigned to fot the 2 Item should be Peter, but your picture displayed that is belong to James, is it wrong?

Based on my understanding, I create the following sample, and you can refer to.

the sample data is the same as you provided, you can create a calculated column in table.

 

 

Column =
VAR _dev =
    MAXX (
        FILTER (
            'Table',
            OR (
                [Parent Id] = EARLIER ( 'Table'[Item Id] ),
                [Parent Id] = EARLIER ( 'Table'[Parent Id] )
            )
                && [Work Type] = "Dev"
        ),
        [Owner]
    )
VAR _qa =
    MAXX (
        FILTER (
            'Table',
            OR (
                [Parent Id] = EARLIER ( 'Table'[Item Id] ),
                [Parent Id] = EARLIER ( 'Table'[Parent Id] )
            )
                && [Work Type] = "QA"
        ),
        [Owner]
    )
RETURN
    IF ( _dev <> BLANK (), _dev, _qa )

 

 

Output

vxinruzhumsft_0-1714699738039.png

 

Best Regards!

Yolo Zhu

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

2 REPLIES 2
v-xinruzhu-msft
Community Support
Community Support

Hi @ErPat 

I found that based on your requirement, the assigned to fot the 2 Item should be Peter, but your picture displayed that is belong to James, is it wrong?

Based on my understanding, I create the following sample, and you can refer to.

the sample data is the same as you provided, you can create a calculated column in table.

 

 

Column =
VAR _dev =
    MAXX (
        FILTER (
            'Table',
            OR (
                [Parent Id] = EARLIER ( 'Table'[Item Id] ),
                [Parent Id] = EARLIER ( 'Table'[Parent Id] )
            )
                && [Work Type] = "Dev"
        ),
        [Owner]
    )
VAR _qa =
    MAXX (
        FILTER (
            'Table',
            OR (
                [Parent Id] = EARLIER ( 'Table'[Item Id] ),
                [Parent Id] = EARLIER ( 'Table'[Parent Id] )
            )
                && [Work Type] = "QA"
        ),
        [Owner]
    )
RETURN
    IF ( _dev <> BLANK (), _dev, _qa )

 

 

Output

vxinruzhumsft_0-1714699738039.png

 

Best Regards!

Yolo Zhu

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

Thank you very much @v-xinruzhu-msft!  You are correct that Peter should be assigned to Item 2.
Does the data in your solution have to be sorted in some way?  I ask because [Owners] from old records somehow gets assigned to current records even though they are not tied to it.  I wish I can share with you sample data but I am constrained in doing so.

Your solution is a very good starting point.  Although, I don't fully understand how it works, I will play around it and hopefully get the data I need.  Otherwise, I'll go back to this thread again for more questions.

Thanks again!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.