cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

## Counting the number of tenants per Property Code

Hi, I'm trying to create a measure that counts how many tenants each Property Code has.

This is my Tenant Table:

This is the code I'm trying (based on a Curbal video: https://www.youtube.com/watch?v=W4OMwdZNRG0)

NumTenants = COUNTAX(
SUMMARIZE(TENANTS,TENANTS[PROP_CODE],TENANTS[TENANT_NAME]),
TENANTS[TENANT_NAME])

When I put the measure into a table with the Property Code and Tenant Name, this is what I'd want it to look like (3rd column):

Am I making this too complicated?  How do I add up the number of tenants for each PROP_CODE?

1 ACCEPTED SOLUTION
Community Champion

Hi @bonjourposte - can you create the below measure with distinctcount to get the numof ten.

NumTenants =
CALCULATE(
DISTINCTCOUNT(TENANTS[TENANT_NAME]),
ALLEXCEPT(TENANTS, TENANTS[PROP_CODE])
)

Hope it works

Did I answer your question? Mark my post as a solution! This will help others on the forum!

2 REPLIES 2

Thanks so much, this looks like it's working. But somehow it's also giving a total of 1 for all the properties that don't have any commercial tenants (like multifamilies, undeveloped lots or parking lots - these are not even loaded into this table yet.  This table is just for commercial properties).  Any guesses where all the 1's are coming from?

Community Champion

Hi @bonjourposte - can you create the below measure with distinctcount to get the numof ten.

NumTenants =
CALCULATE(
DISTINCTCOUNT(TENANTS[TENANT_NAME]),
ALLEXCEPT(TENANTS, TENANTS[PROP_CODE])
)

Hope it works

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - July 2024

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

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors