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
s_mccafferty
Frequent Visitor

DAX: Calculate Percentages

I have a data model similar to the below:

Building Occupier Area
building 1 occupier1 10000
building 1 occupier 2 15000
building 2 occupier 3 10000
building 3 occupier 4 10000
building 3 occupier 5 20000

So essentially, any building can have one or more occupiers. What I am wanting to work out is the percentage each occupier has for the building they occupy. So in the above example, occupier 1 has 10000 sqft of an 25000 sqft building, so they occupy 40% of building 1. How can I calculate that across the entire dataset.

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @s_mccafferty ,

 

Here we can create a measure to work on it.

 

Measure =
VAR oc =
    CALCULATE ( SUM ( Table1[area] ) )
VAR al =
    CALCULATE ( SUM ( Table1[area] ), ALL ( Table1 ), VALUES ( Table1[Building] ) )
RETURN
    DIVIDE ( oc, al )

 

Capture.PNG

Pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @s_mccafferty ,

 

Here we can create a measure to work on it.

 

Measure =
VAR oc =
    CALCULATE ( SUM ( Table1[area] ) )
VAR al =
    CALCULATE ( SUM ( Table1[area] ), ALL ( Table1 ), VALUES ( Table1[Building] ) )
RETURN
    DIVIDE ( oc, al )

 

Capture.PNG

Pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

@v-frfei-msft Perfect, thank you.

thnx, very helpful

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.