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

Dividing the sum of two columns with a filter

I'm trying to do a simple rate calcation, summing an entire column (my numerator) then dividing by the sum an another entire column (my denominator), filter by metric. I have 3 companies in my database, but the formula below keeps returning the rate by company, not aggregating num/den across all 3 companies.

 

ALL_CurrentEngagment = 
           CALCULATE(
                DIVIDE(SUM(STP_OPS_KPI[NUM]),SUM(STP_OPS_KPI[DEN])),
                FILTER(STP_OPS_KPI, STP_OPS_KPI[METRIC]="Current Engaged Population"))

Screenshot 2025-09-12 170544.png

 

 

What am I doing wrong? This should be simple yet I'm struggling.

 

 

1 ACCEPTED SOLUTION
Royel
Solution Sage
Solution Sage

Hi @BrianPansy  lets simplified the dax 

OptimizedTest = 
VAR AllCompanyNum = 
    CALCULATE(
        SUM(STP_OPS_KPI[NUM]),
        REMOVEFILTERS(STP_OPS_KPI[COMPANY]),
        STP_OPS_KPI[METRIC] = "Current Engaged Population"
    )
VAR AllCompanyDen = 
    CALCULATE(
        SUM(STP_OPS_KPI[DEN]),
        REMOVEFILTERS(STP_OPS_KPI[COMPANY]),
        STP_OPS_KPI[METRIC] = "Current Engaged Population"
    )
RETURN DIVIDE(AllCompanyNum, AllCompanyDen)

Test each variables are working perfectly or not. If it works then try this somplified version 

OptimizedRate =
CALCULATE(
    DIVIDE(SUM(STP_OPS_KPI[NUM]), SUM(STP_OPS_KPI[DEN])),
    REMOVEFILTERS(STP_OPS_KPI[COMPANY]),
    STP_OPS_KPI[METRIC] = "Current Engaged Population"
)

 

Find this helpful? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

The ALL() function will have to be used.  Share the download link of the PBI file.  Show the problem and the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Royel
Solution Sage
Solution Sage

Hi @BrianPansy  lets simplified the dax 

OptimizedTest = 
VAR AllCompanyNum = 
    CALCULATE(
        SUM(STP_OPS_KPI[NUM]),
        REMOVEFILTERS(STP_OPS_KPI[COMPANY]),
        STP_OPS_KPI[METRIC] = "Current Engaged Population"
    )
VAR AllCompanyDen = 
    CALCULATE(
        SUM(STP_OPS_KPI[DEN]),
        REMOVEFILTERS(STP_OPS_KPI[COMPANY]),
        STP_OPS_KPI[METRIC] = "Current Engaged Population"
    )
RETURN DIVIDE(AllCompanyNum, AllCompanyDen)

Test each variables are working perfectly or not. If it works then try this somplified version 

OptimizedRate =
CALCULATE(
    DIVIDE(SUM(STP_OPS_KPI[NUM]), SUM(STP_OPS_KPI[DEN])),
    REMOVEFILTERS(STP_OPS_KPI[COMPANY]),
    STP_OPS_KPI[METRIC] = "Current Engaged Population"
)

 

Find this helpful? ✔ Give a Kudo • Mark as Solution – help others too!

Optimize Rate worked perfectly. Thanks a million!

BrianPansy
Frequent Visitor

TY for the prompt reply. I had that at one point in my stuggles.  That works but it doesn't break things out monthly. How do I incorporate that into the formula?

Greg_Deckler
Community Champion
Community Champion

@BrianPansy Maybe:

ALL_CurrentEngagment = 
           CALCULATE(
                DIVIDE(SUM(STP_OPS_KPI[NUM]),SUM(STP_OPS_KPI[DEN])),
                FILTER( ALL(STP_OPS_KPI), STP_OPS_KPI[METRIC]="Current Engaged Population"))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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