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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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