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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mwebergo2
Regular Visitor

Incorrect results for Divide function

I've seen numerous posts on this topic that all seem to indicate the need for a measure instead of calculated column.  I am using measures but still getting incorrect results.  I am trying to dive the sum of Annual Expense by the sum of Book Value to get a ratio of expense to assets under management.  

mwebergo2_0-1736368168362.png

 

This seems so simple, but I am not getting correct results.  The DAX formula I am using is as follows:

Expense Ratio = DIVIDE(CALCULATE(SUM('2025 Baseline Forecast'[Annual Expense])), CALCULATE(SUM('Last Month Positions'[Book Value])),0)
5 REPLIES 5
rmateo
Regular Visitor

  1. Verify Relationships:

    • Ensure there's a valid relationship between '2025 Baseline Forecast' and 'Last Month Positions'.
    • If these tables are not directly related, the SUM calculations might not be in the same filter context.
  2. Test Individual Components:

    • Create separate measures to confirm each component is returning expected results:
      DAX
      Copy code
      TotalExpense = SUM('2025 Baseline Forecast'[Annual Expense]) TotalBookValue = SUM('Last Month Positions'[Book Value])
    • Use these measures in a table visual alongside your dimensions to ensure they calculate correctly.
  3. Validate Filter Context:

    • If your data uses different dimensions (e.g., time, region, category), ensure both tables are being filtered correctly by the same dimensions.
  4. Row-Level Aggregation Check:

    • Ensure the calculation doesn’t suffer from granularity mismatch. For example, if Book Value is stored at a more granular level (e.g., daily) than Annual Expense (e.g., yearly), aggregations might not align correctly.

Adjusted Formula:

If your data model has no issues and you simply need the correct context for the division:

DAX:
Expense Ratio = DIVIDE( CALCULATE(SUM('2025 Baseline Forecast'[Annual Expense])), CALCULATE(SUM('Last Month Positions'[Book Value])), 0 )

Additional Scenarios:

  • If Tables Are Not Related: Use CROSSFILTER or ALL to manipulate filter context:

    DAX
    Expense Ratio = DIVIDE( CALCULATE(SUM('2025 Baseline Forecast'[Annual Expense]), ALL('Last Month Positions')), CALCULATE(SUM('Last Month Positions'[Book Value]), ALL('2025 Baseline Forecast')), 0 )
  • If You Need a Weighted Average: Use a more complex formula to handle weighting:

    DAX
    Expense Ratio = DIVIDE( SUMX( 'YourCommonDimensionTable', CALCULATE(SUM('2025 Baseline Forecast'[Annual Expense])) ), SUMX( 'YourCommonDimensionTable', CALCULATE(SUM('Last Month Positions'[Book Value])) ), 0 )

Visual Troubleshooting:

  • Add the Expense Ratio measure to a matrix visual with relevant dimension columns (e.g., year, category) to confirm results at different levels of granularity.

If the issue persists, share details about the data relationships, granularity, or any specific filters that may affect calculations.

mwebergo2
Regular Visitor

Here's a snip of the dashboard.  The expense ratio card (circled in blue) is the measure I am trying to depict.  It is the results of dividing the two cards just above it.  

mwebergo2_0-1736374203649.png

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

mwebergo2
Regular Visitor

No

lbendlin
Super User
Super User

Do you display that measure next to a column from the Calendar Table?

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 MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.