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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AleksiK
Frequent Visitor

Calculating ratio

Hello, I need help with calculating a ratio between row value and filtered sum. Here's an example:

 

RoomHouseArea (m²)Ratio
AHouse 11000,333333
BHouse 12000,666666
CHouse 21000,5
DHouse 21000,5
EHouse 22000,333333
FHouse 32000,333333
GHouse 32000,333333

 

 

I have this data with houses and rooms inside of them. I want to calculate this ratio column with DAX automatically which divides the area of room with total area of the house.

1 ACCEPTED SOLUTION
Arklur
Resolver II
Resolver II

RoomAreaPerc = 
VAR vTotalHouseArea = 
    CALCULATE ( 
        SUM ( Data[Area] ),
        ALLEXCEPT ( 
            Data,
            Data[House]
        )
    )
RETURN
    DIVIDE ( Data[Area], vTotalHouseArea )

Add this column to the table.

image.png

If you need this as a measure, so filters should be taken into account, the DAX code needs to be changed slightly, but this should kick you off.

View solution in original post

3 REPLIES 3
Pragati11
Super User
Super User

Hi @AleksiK ,

 

You can try something as below: (Created a RATIO measure as shown below)

 

Pragati11_0-1596532014719.png

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

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

Appreciate your Kudos!!

Proud to be a Super User!!

Arklur
Resolver II
Resolver II

RoomAreaPerc = 
VAR vTotalHouseArea = 
    CALCULATE ( 
        SUM ( Data[Area] ),
        ALLEXCEPT ( 
            Data,
            Data[House]
        )
    )
RETURN
    DIVIDE ( Data[Area], vTotalHouseArea )

Add this column to the table.

image.png

If you need this as a measure, so filters should be taken into account, the DAX code needs to be changed slightly, but this should kick you off.

amitchandak
Super User
Super User

@AleksiK , what is the logic for ratio?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors