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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.