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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
bonjourposte
Helper V
Helper V

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
Super User
Super User

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!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
bonjourposte
Helper V
Helper V

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
Super User
Super User

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!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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