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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
k-giles
Regular Visitor

Converting Project WBS to Parent/Child Heirarchy

Hi all,

I'm looking to build a dax to convert the WBS code column into two columns to show the parent/child heirarchy and build a path. This will then be later on used to develop a gantt chart in PBI and show the tasks in a table in correct heirarchical order.

 

kgiles_0-1658721882497.png

 

I've split out the wbs structure into 4 columns

kgiles_1-1658722058236.png

 

Now I'm trying to write a dax that will calcualte the child tasks using the following formula:

WBS Child = IF(ISBLANK([WBS Level.4]),[WBS Level.3],(if(ISBLANK([WBS Level.3]),Tasks[WBS Level.2],(Tasks[WBS Level.2]))))
 
However it is only returning the level 4 or 3 value not returning level 2 values or presenting an error so not sure where I've gone wrong or if this is event the right solution to do this.
kgiles_2-1658722375431.png

 

 

 

 

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @k-giles 

I would recommend you to use SWITCH() instead of IF() .

WBS Child = SWITCH(TRUE(),Tasks[WBS.4]<>BLANK(),Tasks[WBS.4],
                          Tasks[WBS.4]=BLANK() && Tasks[WBS.3]<>BLANK(),Tasks[WBS.3],
                          Tasks[WBS.4]=BLANK() && Tasks[WBS.3]=BLANK() && Tasks[WBS.2]<>BLANK(),Tasks[WBS.2])

The result is as shown :

Ailsamsft_0-1658993287997.png

I have attached my pbix file , you can refer to it .

 

Best Regards,
Community Support Team _ Ailsa Tao
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

1 REPLY 1
Anonymous
Not applicable

Hi @k-giles 

I would recommend you to use SWITCH() instead of IF() .

WBS Child = SWITCH(TRUE(),Tasks[WBS.4]<>BLANK(),Tasks[WBS.4],
                          Tasks[WBS.4]=BLANK() && Tasks[WBS.3]<>BLANK(),Tasks[WBS.3],
                          Tasks[WBS.4]=BLANK() && Tasks[WBS.3]=BLANK() && Tasks[WBS.2]<>BLANK(),Tasks[WBS.2])

The result is as shown :

Ailsamsft_0-1658993287997.png

I have attached my pbix file , you can refer to it .

 

Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.