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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
mfaisalk
Regular Visitor

how to add a new column based on two condition in existing columns.

Hello,

This question relates to the Power query in Excel.

 

Column "Lost" as shown in screenshot has either dates or blanks. I want to add a new column based on the column "lost" with the following conditions.

1. If there is any date in the column "Lost", the corresponding row in the new column should say "Lost."

2, If there is any cell with no data, the corresponding row in the new column shall say "New."

 

How can I achieve this?

 

 

 

2022-12-25-22-04-45.png

1 ACCEPTED SOLUTION

You can eventually use bit more sofisticated formula, which evaluate data type:

Migasuke_0-1672000326648.png

 

 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

View solution in original post

3 REPLIES 3
Migasuke
Super User
Super User

Hi @mfaisalk ,

I used simple conditional column. Truth is, it does not consider data types, so it not might be the perfect solution. In case you have only dates or nulls, then  following formula will solve your problem:

Migasuke_0-1671996972933.png

 

 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

You can eventually use bit more sofisticated formula, which evaluate data type:

Migasuke_0-1672000326648.png

 

 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

Thanks a lot, the first simple will work perfectly....as the data type is  only date. As I have blank cells so, instead of null, I used blank as a condition. see screenshot  apE8dvP

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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