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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Herdichek
Frequent Visitor

Calculated column based on conditions in Child rows

Hi all

 

I am currently creating a dashboard of data extracted from DevOps. I am trying to create a visual for our product owners, where it shows all of the features (parents) where all the underlying user stories/tasks (children) have been finished/closed. As such, i need a column that returns a "Done" or "In Progress" for each feature, to show whether or not the underlying work items are finished. 

 

I've made the following example with data: What i would love to have is the "Feature Status" column. 

Herdichek_0-1664526690968.png

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @Herdichek 

Here are the steps you can refer to :

(1)This is my test data:

vyueyunzhmsft_0-1664776604694.png

(2)We can creat a calculated column to falg  the 'State' field:

Flag = IF('Sheet1'[State]="Active" , 1 ,0)

(3)We can create another calculated column and then we can meet your need:

Feature Satus = 
var _count = PATHLENGTH('Sheet1'[Path])
var _last_level  = CONVERT( PATHITEM( 'Sheet1'[Path] , _count) ,INTEGER)+0
var _t2 =SUMX( FILTER('Sheet1' , PATHCONTAINS('Sheet1'[Path] , _last_level) && PATHLENGTH('Sheet1'[Path])<> _count ) , [Flag])
return 
 IF( 'Sheet1'[Type] = "Feature" ,  IF(_t2 =0 ,"Done" , "Is progressing" ) , BLANK())

(4)The result is as follows:

vyueyunzhmsft_1-1664776715811.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

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

4 REPLIES 4
v-yueyunzh-msft
Community Support
Community Support

Hi , @Herdichek 

Here are the steps you can refer to :

(1)This is my test data:

vyueyunzhmsft_0-1664776604694.png

(2)We can creat a calculated column to falg  the 'State' field:

Flag = IF('Sheet1'[State]="Active" , 1 ,0)

(3)We can create another calculated column and then we can meet your need:

Feature Satus = 
var _count = PATHLENGTH('Sheet1'[Path])
var _last_level  = CONVERT( PATHITEM( 'Sheet1'[Path] , _count) ,INTEGER)+0
var _t2 =SUMX( FILTER('Sheet1' , PATHCONTAINS('Sheet1'[Path] , _last_level) && PATHLENGTH('Sheet1'[Path])<> _count ) , [Flag])
return 
 IF( 'Sheet1'[Type] = "Feature" ,  IF(_t2 =0 ,"Done" , "Is progressing" ) , BLANK())

(4)The result is as follows:

vyueyunzhmsft_1-1664776715811.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

This is exactly what i needed, thank you very much!

komald
Helper I
Helper I

@Herdichek , on which column basis u need to show feature status? 

if you want to show according to state column
then creadte calculate column

feature status= if(state="Active", "done","closed")

 

I want the "Feature Status" to return either "Done" (If all of it's children (ie. "User Story"/"Task") are state "Closed") or return "In Progress" if any of the underlying children are still "Active". The column should only contain values for the rows containing type "Feature". 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.