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

Create a column with Condition.

Hello,

 

I have a column with Product numbers that are as follows 6500N,76MR1,9ES00A and from these i would derive the Product Type as if the Product Number start with '65' then the Product Type is a,if starts with '76' then B and if starts with '9' then C.How do i do this the easiest way

1 ACCEPTED SOLUTION
Anonymous
Not applicable

In the PowerQuery window, you could click on the Add Column tab in the ribbon and choose a conditional column.

 

ConditionalColumn.png

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

In the PowerQuery window, you could click on the Add Column tab in the ribbon and choose a conditional column.

 

ConditionalColumn.png

 

 
Anonymous
Not applicable

The original Code created by Power Query was this:

  1. = Table.AddColumn(_Customers, "Custom", each Date.Year([BirthDate]), type number)

I simply changed the code directly in the Formula Bar to be like this:

= Table.AddColumn(_Customers, "Age", each 2016 - Date.Year([BirthDate]), type number)
 

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.