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
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")

 

 

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")

 

 

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.