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
Sab
Helper V
Helper V

Compare rows in Power Query

Hello all,

 

As you can see from the image, I need to take the value from the Date column into the new column I am creating, if the value in the subsequnet row is different than the actual row.

 

The easy part is done, so when the Costs is zero then all good. I tried the formula you see, but it takes into consideration only the first part, so If [Costs] = 0.

 

Thank you!

 

@ImkeF 

image.png

3 REPLIES 3
v-angzheng-msft
Community Support
Community Support

Hi, @Sab 

 

May I ask if your problem has been solved? Is the above post helpful to you?

If  it does, could you please mark the post which help as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

 

 

 

Best Regards,
Community Support Team _ Zeon Zheng

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ImkeF
Super User
Super User

Hi @Sab ,
I would recommend to add a column that contains the value from the previous row. Then you can write out your logic for the new column with references to the current row only.
If performance matters, you have to use this function to retrieve the value from the previous row: 
https://wp.me/p6lgsG-Vo

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

HotChilli
Super User
Super User

I think it's best if you debug this by simplifying the code in the column.

Save your column code elsewhere and then test just the reference to the previous row.  If i was you I would even remove the comparison and just get the value from the previous row.  It might not be what you think it is.

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.