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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-stephen-msft
Community Support
Community Support

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
v-stephen-msft
Community Support
Community Support

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

Anonymous
Not applicable

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.