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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
Impactful Individual
Impactful Individual

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
Impactful Individual
Impactful Individual

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors