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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Domien
Regular Visitor

Content from a previous row

Hi,

 

I want to make new column in which I want to put the content of an existing colomn "A" or the content from the previous row of the new colom depending on the content of column "A".

 

In Excel I can use this formula: IF(left(A2;1)="-";C1;B2)

 

Domien_0-1694516189779.png

 I've tried several options (even chat GPT) but it won't work.

 

Kind regards,

Domien

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

7 REPLIES 7
Ahmedx
Super User
Super User

watch my video and you will find out how to do this

https://1drv.ms/v/s!AiUZ0Ws7G26RilMxk2FOgGDXB3VF?e=GZcDre

Thanks!. This works perfect for me!!

HarishKM
Memorable Member
Memorable Member

@Domien Hello,
you can refer this dax.
 Create a column then create the same measure and replace the result and alternate result column.

New column = IF(Sheet1[Product]= BLANK(), Expected result column, alternate result column )


Thanks
Harish M

@Domien Hello,
I meant this.

Color = IF(Sheet1[Product]= BLANK(), Sheet1[Product_new] )

I mean Instead of product new you can use B column.

Thanks
Harish M

Hi Harish,

I'm sorry but I don't know what you mean 

Domien
Regular Visitor

Thanks, for the quick reply.

 

I've tried something simular but when I use your solution I get errors whent the first character is an "-"

Domien_0-1694519744209.png

 

I've used this formula. I've checked the column names so that could not be the problem

 

Domien_1-1694519818946.png

 

 

 

123abc
Community Champion
Community Champion

In Power Query, you can create a new column that depends on the content of an existing column "A" or the content from the previous row of the new column based on the content of column "A." You can achieve this using the following steps:

  1. Open Power Query Editor in Power BI or Excel.

  2. Select your table that contains column "A."

  3. Go to the "Add Column" tab and click on "Custom Column."

  4. In the "Custom Column" dialog box, enter a name for the new column (e.g., "NewColumn").

  5. In the "Custom column formula" box, enter the following formula:

if Text.Start([A], 1) = "-" then [NewColumn]{[Index]-1} else [A]

 

This formula checks if the first character of column "A" is "-", and if it is, it retrieves the value from the previous row of the "NewColumn"; otherwise, it takes the value from column "A."

  1. Click the "OK" button to create the new column.

This will create a new column "NewColumn" that meets your specified conditions. If the first character of column "A" is "-", it will take the value from the previous row of "NewColumn"; otherwise, it will take the value from column "A."

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.