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
rafterse
Helper I
Helper I

nested if, i think in power query

Hey all ,

i'm struggeling with this one 

i want to create a sequence of columns based on the workgroup column grouping 

Data

Work Group   Task 
Work Group a  Initial task a
Work Group a  Secondary task a
Work Group B  Initial task B
Work Group B  secondary task B
Work Group B  tertiery task B

 

thanks in advance 

output needed 

1st task 2nd Task 3rd TaskWork Group 
initial task a   secondary task a   workgroup A   
initial task B  secondary task B  tertiery task B  Workgroup B  
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @rafterse 

You can create a blank query and input the following code to advanced editor.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCs8vylZwL8ovLVBIVFBQ0lHyzMssyUzMUShJLM5WSFSK1cGiJjg1OT8vJbGoEocqJ0yTnLCrKUY1CYeqktSiksxUJEWxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Work Group" = _t, Task = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Work Group", type text}, {"Task", type text}}),
    #"Uppercased Text" = Table.TransformColumns(#"Changed Type",{{"Task", Text.Proper, type text}}),
    #"Added Custom" = Table.AddColumn(#"Uppercased Text", "Task_type", each let a=Text.PositionOf([Task],"Task")
in Text.Start([Task],a-1)),
    #"Pivoted Column" = Table.Pivot(#"Added Custom", List.Distinct(#"Added Custom"[Task_type]), "Task_type", "Task")
in
    #"Pivoted Column"

 

Output

vxinruzhumsft_0-1715650223665.png

Best Regards!

Yolo Zhu

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
Anonymous
Not applicable

Hi 

hi\

 

Anonymous
Not applicable

Hi @rafterse 

You can create a blank query and input the following code to advanced editor.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCs8vylZwL8ovLVBIVFBQ0lHyzMssyUzMUShJLM5WSFSK1cGiJjg1OT8vJbGoEocqJ0yTnLCrKUY1CYeqktSiksxUJEWxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Work Group" = _t, Task = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Work Group", type text}, {"Task", type text}}),
    #"Uppercased Text" = Table.TransformColumns(#"Changed Type",{{"Task", Text.Proper, type text}}),
    #"Added Custom" = Table.AddColumn(#"Uppercased Text", "Task_type", each let a=Text.PositionOf([Task],"Task")
in Text.Start([Task],a-1)),
    #"Pivoted Column" = Table.Pivot(#"Added Custom", List.Distinct(#"Added Custom"[Task_type]), "Task_type", "Task")
in
    #"Pivoted Column"

 

Output

vxinruzhumsft_0-1715650223665.png

Best Regards!

Yolo Zhu

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

 

thanks i'll give it a go 

 

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Kudoed Authors