Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
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
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 27 | |
| 23 | |
| 18 | |
| 18 | |
| 15 |
| User | Count |
|---|---|
| 54 | |
| 44 | |
| 42 | |
| 39 | |
| 36 |