cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ashmj12 Frequent Visitor
Frequent Visitor

Return “1” or “2” for Empty cells depending on value in a column

NameRESULT
AA 
AA 
 1
BB 
BB 
 2
 2
BB 
BB 

 

 

 

 

I am looking for a calculated column for empty cells in the "Name" Column that should return "1" in result column if the previous value in "Name" Column is not equal and if equal it should return "2" in the result column.

For Example, in the above table, row 3 in the Name Column is empty and row 2 in the Name column is "AA" and row 4 in Name Column is "BB" so it should return "1" in the result column. Because "AA" and "BB" are different.

Row 6 & 7 in the Name Column are also empty, but the Name Column value in row 5 and 8 are equal so it should return as "2" in row 6 & 7 in the result column.

1 REPLY 1
Super User
Super User

Re: Return “1” or “2” for Empty cells depending on value in a column

You are going to need an Index column and use EARLIER if you want to do this in DAX. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!