The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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:
A | B | |
1 | 0 | |
2 | 0 | FAUX |
3 | 1 | VRAI |
4 | 1 | FAUX |
5 | 1 | FAUX |
6 | 1 | FAUX |
7 | 0 | FAUX |
8 | 0 | FAUX |
9 | 1 | VRAI |
10 | 1 | FAUX |
11 | 0 | FAUX |
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!
Solved! Go to Solution.
@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")
@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")
User | Count |
---|---|
82 | |
81 | |
35 | |
32 | |
32 |
User | Count |
---|---|
93 | |
79 | |
62 | |
54 | |
51 |