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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Roy_tap
Helper I
Helper I

Creating a new column using either custom or conditional column value

Hi,

 

I have an existing import table containing of date values as such:

ProcessStep NameLast UpdateStep aStep bStep cStep d
P1Step a01-01-0101-01-01   
P2Step b07-07-0103-03-0107-07-01  
P3Step a02-02-0102-02-01   
P4Step d06-06-0104-04-01  06-06-01
P5Step c05-05-0103-03-01 05-05-01 

 

How can I create a new column to replace the Last Update column in the Query Studio to meet the following condition:
When Step Name = Step b, Last Update will be replace with Step a value

When Step Name = Step d, Last Update will be replace with Step a value

Else = Last Update value

Final table should looks like this: (Highlighted value is the updated value)

ProcessStep NameLast UpdateStep aStep bStep cStep dLast Update1
P1Step a01-01-0101-01-01   01-01-01
P2Step b07-07-0103-03-0107-07-01  03-03-01
P3Step a02-02-0102-02-01   02-02-01
P4Step d06-06-0104-04-01  06-06-0104-04-01
P5Step c05-05-0103-03-01 05-05-01 05-05-01

 

Thanks.

1 ACCEPTED SOLUTION
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Roy_tap 

 

add a custom column

Vera_33_0-1631772866191.png

 

if [Step Name]="Step b" or [Step Name]="Step d" then [Step a] else [Last Update]

 

View solution in original post

2 REPLIES 2
watkinnc
Super User
Super User

In the formula bar, type:

 

= Table.AddColumn(NameOfPriorStep, "Last Update 1", each if [Step Name] = "Step b" then [Step a] else if [Step Name] = "Step d" then [Step a] else [Last Update])

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Roy_tap 

 

add a custom column

Vera_33_0-1631772866191.png

 

if [Step Name]="Step b" or [Step Name]="Step d" then [Step a] else [Last Update]

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors