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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Custom Column

Hi Experts

Need a custom Column to do the following please.

If Column A begins with G1 in column A and UF71 Column B - Direct,

If Column A does not end in a 1 i.e G2 then Alternative,

If Column A is G2 and column B is UF72 - Direct,,,

If Column A is G3 and column B is UF73 - Direct,,,and so on

if column A iss ZZ and column B is UF71 ignore...

 

Sample

Column AColumn BResult
G1UF71Direct
G2UF72Direct
G3UF73Direct
G4UF74Direct
G5UF75Direct
G6UF76Direct
G7UF77Direct
G8UF78Direct
ZZUF71Ignore
ZZUF72Ignore
ZZUF73Ignore
ZZUF74Ignore
ZZUF75Ignore
ZZUF76Ignore
ZZUF77Ignore
ZZUF78Ignore
G1UF72Alternative
G1UF73Alternative
G1UF74Alternative
G1UF75Alternative
G1UF76Alternative
G1UF77Alternative
G1UF78Alternative
G2UF73Alternative
G2UF74Alternative
G2UF75Alternative
G2UF76Alternative
G2UF77Alternative
G2UF78Alternative
G2UF71Alternative
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Try to add a custom column in PQ

if [Column A]="ZZ" then "Ignore" else if Text.End([Column A],1) = Text.End([Column B],1) then "Direct" else "Alternative"

28.png

 

You can check details from the attachemet.

 

Best Regards,

Stephen 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

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

Try to add a custom column in PQ

if [Column A]="ZZ" then "Ignore" else if Text.End([Column A],1) = Text.End([Column B],1) then "Direct" else "Alternative"

28.png

 

You can check details from the attachemet.

 

Best Regards,

Stephen Tao

 

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

amitchandak
Super User
Super User

@Anonymous , You have to create a new column like

 

 

Switch( true(),
left([Column A],2) ="G1" && [Column B] = "UF71", "Direct",
left([Column A],2) ="G2" && [Column B] = "UF72", "Direct",
left([Column A],2) ="G3" && [Column B] = "UF73", "Direct",
right([Column A],1) <> "1" , "Alternative",
left([Column A],2) ="ZZ","Ignore"
)

 

Add more conditions if needed

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi Amit Apologies.... Can thisbe done in Power Query re Custom Column...Not calculated Column...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.