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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Super User

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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