Skip to main content
cancel
Showing results for 
Search instead 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

Reply
bonjourposte
Advocate II
Advocate II

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:

bonjourposte_1-1720640437611.png

 

 

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):

bonjourposte_0-1720640335565.png

 

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

1 ACCEPTED SOLUTION
rajendraongole1
Community Champion
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!
Appreciate your Kudos!!

View solution in original post

2 REPLIES 2
bonjourposte
Advocate II
Advocate II

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?

 

bonjourposte_0-1720642199555.png

 

rajendraongole1
Community Champion
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!
Appreciate your Kudos!!

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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