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
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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.