Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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
Greg_Deckler
Super User
Super User

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...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.