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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
gsanterre
New Member

Comparison between two consecutive rows in the same column

Hi!

 

I want to compare two consecutive rows in same column using AND function in Power Bi. I managed to do this very easily in Excel. Here is what I did in Excel: B2 = AND (A1 = 0; A2 = 1). To sum up, I have a column with 1 and 0. I want to identify all the 1 that come after a 0. Here is an example of what it should look like:

 

 AB
10 
20FAUX
31VRAI
41FAUX
51FAUX
61FAUX
70FAUX
80FAUX
91VRAI
101FAUX
110FAUX

 

I feel like it's simple, but I don't know Power BI well enough. Maybe I need to think it in another way?

 

Thanks for your help!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@gsanterre , Make sure you have an index column or add a new column given below

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

if([index] =1 && maxx(filter(Table,[index] =earlier([index])-1 && [index] =0),[index]) , "VRAI", "FAUX")

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@gsanterre , Make sure you have an index column or add a new column given below

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

if([index] =1 && maxx(filter(Table,[index] =earlier([index])-1 && [index] =0),[index]) , "VRAI", "FAUX")

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors