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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to calculate which period a customer was a tenant

Hey everyone, 

Could you help with a calculation to count the number of customers who were tenants within a specific year?

 

For example in 2010, how many people were tenants - meaning every customer who had an active tenancy before and up to 2010 and tenant end date after 2010 and still active (blank)

 

I'm unable to attach the excel file which details the data. I have too many rows to PrintScreen it

 

 

 

Mojisola_0-1664374770240.png

Filter on Tenant Start Date to 2010

Mojisola_1-1664374812131.png

Filter on Tenant End Date after 2010

 

I would like to calculate this year on year to date.

 

Thank you for taking the time 

 

 

 

2 REPLIES 2
v-yinliw-msft
Community Support
Community Support

Hi @Anonymous ,

 

If I understand your requests correctly, you can try this method below:

I create a sample table to do this:

vyinliwmsft_0-1664429875581.png

 

 

And then, find the max year and the min year. Measure below:

Measure:

Min Year = MIN('Test Table'[Tenant Start Date].[Year])

Max Year = MAX('Test Table'[Tenant End Date].[Year] )

Then we can get a table between the min and the max year:

Measure:

Year Table = CALENDAR(DATE([Min Year],1,1), DATE([Max Year],1,1))

vyinliwmsft_1-1664429875583.png

 

And retain the years, create a new table:

Years = ALL('Year Table'[Date].[Year])

vyinliwmsft_2-1664429875584.png

 

In the “Years” table, we need to find out the number of tenant :

New a column:

Number of Customers =
CALCULATE (
    COUNT ( 'Test Table'[Tenant ID] ),
    FILTER (
        'Test Table',
        'Test Table'[Tenant Start Date].[Year] <= [Year]
            && 'Test Table'[Tenant End Date].[Year] >= [Year]
    )
)

Then we can get the table below:

vyinliwmsft_3-1664429875584.png

 

In the report, set a slicer with Year and set a card with Number of Customers:

vyinliwmsft_4-1664429875585.png

 

vyinliwmsft_5-1664429875586.png

 

 

Can this solve your questions?

Hope this helps you.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you, @v-yinliw-msft. the calculation did not work for this particular question. The numbers are less than they need to be. Is there a way to send the dataset?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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