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.
Hi everyone,
I am trying to create a new column (or perhaps a measure) that will serve as a flag indicating if a row is equal to the previous row. if yes then 1 else 0
In the above example, I want to be able to flag H12-12 | Red as 0 and H12-13 | Pink as 0 while the rest as 1.
Any tips on how to this will be superhelpful
PBI doesn't really 'sort' data when processing.
If your dataset isn't too big, you could use a python script in the power Query editor
First add a blank column (Add a column -> custom column) (in my example I named it column4). The python script would look like this :
prevline = ''
for data in dataset:
data.column4 = 1 if (data.column1 == prevline) else 0
prevline = data.column1
Here is the MS documentation on how to use Python in power Query : https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-in-query-editor
If this answer works, please mark it as a solution 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
116 | |
102 | |
78 | |
77 | |
49 |
User | Count |
---|---|
145 | |
108 | |
107 | |
89 | |
61 |