Forum Discussion
Vivek_KV_
2 years agoFrequent Visitor
Custom Column which referring to it's own while creating
Hello fellow community members, I'm currently facing a challenge in applying a logic in DAX for a table with four columns: LINE_2, HDR, NEW_ACCT, and CHANGE. Specifically, I'm working on creating a ...
lbendlin
Super User
2 years ago
want LINE_FLD to be set to "Y" if either LINE_2 is "Y" or the previous row's LINE_FLD is "Y," and the rest of the three columns (HDR, NEW_ACCT, CHANGE) are all "N".
You need to bring your own definition of what you mean by "previous row". Neither Power Query nor DAX does not do that for you, at least not in a usable way.
To make matters worse you are referencing the field that you are adding. That can only be done with List.Accumulate. It is impossible to do in DAX.
You say you are dealing with a large dataset. How large? Millions of rows? The operation will require half the square of your number of rows in computations.
Your logic already stumbles at the first hurdle. For your first row there is no "Previous row" but you have not specified how to handle that scenario.