cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rptmaxer
Frequent Visitor

Count Instance of value in another column excluding rows based on value in a third column

Hello, I’m very new to Power BI and have spent many hour trying to solve this problem in both DAX and Power Query.
This is an example of the table I have. The idea is to count how many times the parent project occurs in the list of child projects.
Then add a column and mark with "A" for the rows where the parent does not appear.
Then in the next column repeat the logic above but exclude the rows containing "A" rows return with 0 this time marked with "B"
Repeat until all rows marked.

rptmaxer_0-1618777479062.png

I have successfully completed the table up to the first pass and Sequence 1 (A) in both DAX and Power Query but am stuck on evaluating the rows excluding "A" to achieve the next pass.

I know this approach has limitations in terms of coping when more rows are added, the ultimate goal is to be able to determine and return the sequence using just one or two columns.

I appreciate any help that can be given.

 

2 REPLIES 2
rptmaxer
Frequent Visitor

Apologies if there is a better way to provide data. This is my first post.

Sample Data

 

Parent Project Child Project
Item 2 Item 1
Item 2 Item 7
Item 3 Item 2
Item 4 Item 6
Item 5 Item 6
Item 6 Item 8
Item 6 Item 3

expected outcome 

Parent Project Child Project Pass 1 Sequence A Pass 2 Sequence B Pass 3 Sequence C Pass 4 Sequence D
Item 2 Item 1 1 1 1 0 D
Item 2 Item 7 1 1 1 0 D
Item 3 Item 2 1 1 0 C
Item 4 Item 6 0 A
Item 5 Item 6 0 A
Item 6 Item 8 2 0 B
Item 6 Item 3 2 0 B


Ultimate outcome (if possible)

Parent Project Child Project Sequence
Item 2 Item 1 D
Item 2 Item 7 D
Item 3 Item 2 C
Item 4 Item 6 A
Item 5 Item 6 A
Item 6 Item 8 B
Item 6 Item 3 B


Thank you.

lbendlin
Super User III
Super User III

Sounds like a standard "Filtering up" pattern. Please provide sample data in usable format (not as a picture) and show the expected outcome.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors