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

If logic help

Hi,

Can any one please help me to derive below Type Flag as column from Main Num and Alternate Number based on below logic.

 

if Main Num not repeated in Alternate Number then it's parent
if Main Num is repeated in Alternate Number and also Alternate Number is repeated in Main Number then it's Child- Parent
if Main Num is repeated in Alternate Number and Alternate Number is not repeated in Main Number then it's Child

 

paw1_0-1678375375598.png

i have tried below custom column in power query but it's not working for all above three conditions.

 #"Added Custom" = Table.AddColumn(#"Filled Down", "Flag", each if List.Contains(#"Filled Down"[number],[associated number]) then "Parent" else "Child")

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @paw1 ,

 

I think you can try this code to create a custom column.

let 
_MainNum = #"Changed Type"[Main Num],
_AltNum = #"Changed Type"[Alternate Number]
in
if List.Contains(_AltNum,[Main Num]) 
then
if List.Contains(_MainNum,[Alternate Number]) 
then "Child- Parent" else "Child"
else "Parent"

Result is as below.

RicoZhou_0-1678699353558.png

 

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @paw1 ,

 

I think you can try this code to create a custom column.

let 
_MainNum = #"Changed Type"[Main Num],
_AltNum = #"Changed Type"[Alternate Number]
in
if List.Contains(_AltNum,[Main Num]) 
then
if List.Contains(_MainNum,[Alternate Number]) 
then "Child- Parent" else "Child"
else "Parent"

Result is as below.

RicoZhou_0-1678699353558.png

 

Best Regards,
Rico Zhou

 

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

paw1
Helper I
Helper I

@Anonymous Could you please help me on this logic

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.