How to write dax formula like lag function without circular dependency in Excel Power Pivot

62 views Asked by At

failed lag function picture

I wrote dax formula like lag function as this picture in Excel Power Pivot, but a circular dependency was detected.

How do I avoid such a dependency?

This is the formula in column c:

=var lag=LOOKUPVALUE(table1[c],table1[num],table1[num]-1)
return switch(true,
[num]=1,0,
lag>[a],lag-[a],
lag+[b])
0

There are 0 answers