This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreGet Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.
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:
| EntryNo | Date | PropertyN Inclusive | BuildingN Inclusive | Title | TenantN Inclusive | Break | End Da | bef | rec | After | TES_Title_First Entry | After2 | Ret | Expected |
| 173 | 29/04/2021 12:34 | Property A | Building A | Unit C | Client1 | 31/12/2019 00:00 | 0 | 0 | 1 | 1 | 1 | |||
| 173 | 29/04/2021 13:30 | Property A | Building A | Unit C | Client1 | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | Remained | ||
| 173 | 30/04/2021 14:42 | Property A | Building A | Unit C | Client1 | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | |||
| 173 | 09/05/2021 16:45 | Property A | Building A | Unit C | Client1 | 12/04/2021 00:00 | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | ||
| 173 | 09/05/2021 17:45 | Property A | Building A | Unit C | Client1 | 02/05/2021 00:00 | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | ||
| 173 | 21/05/2021 13:44 | Property A | Building A | Unit C | Client1 | 02/05/2021 00:00 | 31/12/2021 00:00 | 1 | 0 | 0 | 0 | 0 | ||
| 173 | 21/05/2021 13:44 | Property A | Building A | Unit C | Client1 | 31/12/2021 00:00 | 0 | 1 | 0 | 0 | 0 | Remained | Remained | |
| 173 | 21/05/2021 15:12 | Property A | Building A | Unit C | Vacant | 31/12/2021 00:00 | 0 | 0 | 1 | 0 | 0 | Left | Left | |
| 173 | 22/05/2021 11:41 | Property A | Building A | Unit C | Vacant | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | |||
| 173 | 23/05/2021 19:43 | Property A | Building A | Unit C | Vacant | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | |||
| 173 | 23/05/2021 19:43 | Property A | Building A | Unit C | Vacant | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | |||
| 173 | 23/05/2021 19:43 | Property A | Building A | Unit C | Vacant | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | |||
| 173 | 24/05/2021 00:56 | Property A | Building A | Unit C | Vacant | 15/09/2021 00:00 | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | ||
| 173 | 24/05/2021 01:21 | Property A | Building A | Unit C | Vacant | 30/09/2021 00:00 | 31/12/2021 00:00 | 0 | 0 | 0 | 0 | 0 | ||
| 173 | 24/05/2021 01:26 | Property A | Building A | Unit C | Vacant | 31/01/2022 00:00 | 0 | 0 | 0 | 0 | 0 | |||
| 173 | 24/05/2021 01:38 | Property A | Building A | Unit C | Vacant | 06/02/2022 00:00 | 1 | 0 | 0 | 0 | 0 | |||
| 173 | 24/05/2021 01:38 | Property A | Building A | Unit C | Vacant | 06/02/2022 00:00 | 0 | 1 | 0 | 0 | 0 | |||
| 173 | 24/05/2021 01:40 | Property A | Building A | Unit C | Client3 | 06/02/2022 00:00 | 0 | 0 | 1 | 0 | 1 | |||
| 173 | 23/08/2021 09:53 | Property A | Building A | Unit C | Client3 | 06/02/2022 00:00 | 0 | 0 | 0 | 0 | 0 | |||
| 173 | 23/08/2021 09:57 | Property A | Building A | Unit C | Client3 | 06/02/2022 00:00 | 1 | 0 | 0 | 0 | 0 | |||
| 173 | 23/08/2021 09:57 | Property A | Building A | Unit C | Client3 | 06/02/2022 00:00 | 0 | 1 | 0 | 0 | 0 | Remained |
Logic:
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
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
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 25 | |
| 24 | |
| 22 | |
| 21 | |
| 19 |
| User | Count |
|---|---|
| 56 | |
| 52 | |
| 49 | |
| 25 | |
| 25 |