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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors