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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Calvin69
Helper III
Helper III

Flag Rows per Multiple Conditions

Hi all,

 

I have the following sample data which I am tryinng to use in order to created a new column that would flag when a tenant remains or departes.

Expected Column is what I am after:

EntryNoDatePropertyN InclusiveBuildingN InclusiveTitleTenantN InclusiveBreakEnd DabefrecAfterTES_Title_First EntryAfter2RetExpected
17329/04/2021 12:34Property ABuilding AUnit CClient1 31/12/2019 00:0000111  
17329/04/2021 13:30Property ABuilding AUnit CClient1 31/12/2021 00:0000000 Remained
17330/04/2021 14:42Property ABuilding AUnit CClient1 31/12/2021 00:0000000  
17309/05/2021 16:45Property ABuilding AUnit CClient112/04/2021 00:0031/12/2021 00:0000000  
17309/05/2021 17:45Property ABuilding AUnit CClient102/05/2021 00:0031/12/2021 00:0000000  
17321/05/2021 13:44Property ABuilding AUnit CClient102/05/2021 00:0031/12/2021 00:0010000  
17321/05/2021 13:44Property ABuilding AUnit CClient1 31/12/2021 00:0001000RemainedRemained
17321/05/2021 15:12Property ABuilding AUnit CVacant 31/12/2021 00:0000100LeftLeft
17322/05/2021 11:41Property ABuilding AUnit CVacant 31/12/2021 00:0000000  
17323/05/2021 19:43Property ABuilding AUnit CVacant 31/12/2021 00:0000000  
17323/05/2021 19:43Property ABuilding AUnit CVacant 31/12/2021 00:0000000  
17323/05/2021 19:43Property ABuilding AUnit CVacant 31/12/2021 00:0000000  
17324/05/2021 00:56Property ABuilding AUnit CVacant15/09/2021 00:0031/12/2021 00:0000000  
17324/05/2021 01:21Property ABuilding AUnit CVacant30/09/2021 00:0031/12/2021 00:0000000  
17324/05/2021 01:26Property ABuilding AUnit CVacant 31/01/2022 00:0000000  
17324/05/2021 01:38Property ABuilding AUnit CVacant 06/02/2022 00:0010000  
17324/05/2021 01:38Property ABuilding AUnit CVacant 06/02/2022 00:0001000  
17324/05/2021 01:40Property ABuilding AUnit CClient3 06/02/2022 00:0000101  
17323/08/2021 09:53Property ABuilding AUnit CClient3 06/02/2022 00:0000000  
17323/08/2021 09:57Property ABuilding AUnit CClient3 06/02/2022 00:0010000  
17323/08/2021 09:57Property ABuilding AUnit CClient3 06/02/2022 00:0001000Remained

 

Logic:

  • When a client changes to a new one Status should be "Left"
  • When a client is still the same but end date changes to future date, status should be "Remained"
  • When a client is still the same but break changes to future, status should be "Remained"
  • When client = "Vacant" and previous entry was <> "Vacant", status should be "Left"

 

Using the following code and after creating multiple columns "Before/Recent/After" I was able to create column "RET" but still not right, can you please help?

 

 

 

 

 

Ret = 
VAR TenantB = CALCULATE(VALUES('Table'[TenantN Inclusive]), 'Table'[bef] = 1)
VAR TenantC = CALCULATE(VALUES('Table'[TenantN Inclusive]), 'Table'[rec] = 1)

VAR BreakPRe = CALCULATE(VALUES('Table'[Break]), 'Table'[bef] = 1)
VAR BreakCurr = CALCULATE(VALUES('Table'[Break]), 'Table'[rec] = 1)

VAR TenantAA = CALCULATE(VALUES('Table'[TenantN Inclusive]), 'Table'[After] = 1)

VAR IFs = IF(
            'Table'[TenantN Inclusive] = "Vacant - LCR"
            || 'Table'[bef] = 0  &&  'Table'[rec] = 0
            || 'Table'[bef] = 1,
        BLANK(),
        IF( 
            OR(BreakPRe < BreakCurr || TenantB = TenantC,
                BreakCurr = BLANK() && BreakPRe <> BLANK()
                ),
        "False",
        "True"))

VAR GUR = SWITCH(
                TRUE(),
                IFs = "True", "Remained",
                'Table'[After] = 0, BLANK(),
                'Table'[TES_Title_First Entry] = 1, BLANK(),
                TenantC <> TenantAA || TenantC = "Vacant", "Left",
                "Left")

VAR IFY = IF('Table'[After2] = 1, BLANK(), GUR)


Return
IFY

 

 

 

 

 

I am so close...

Thanks

H

2 REPLIES 2
Anonymous
Not applicable

Hi @Calvin69 

What are the values for fields 'Table'[TES_Title_First Entry] and 'Table'[After2] , In the data you provided, I did not find these two fields . Can you provide the values of these two fields ?

 

Best Regards

Community Support Team _ Ailsa Tao

Thanks @Anonymous for looking into this and apologies for the very late reply.

 

I have amended the table data to include missing columns.

 

Thanks in advance.

H

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.