Forum Discussion

TomSinAA's avatar
TomSinAA
Icon for Helper IV rankHelper IV
1 year ago

measure not calculating % correctly

I have a measure with the following formula:

% of Shipment by PickupPerformance by Site =
DIVIDE(SUM(TMSShipmentDetail[ShipmentCount]), CALCULATE(SUM(TMSShipmentDetail[ShipmentCount]),all(TMSShipmentDetail[Pickup Performance],TMSShipmentDetail[Site])))

 

For an individual site here the numbers:

 

StateCount% from Excel% from PBI Measure
blank2482.11%2.00%
early912277.51%71.80%
late181415.41%14.30%
On Time5854.97%4.60%
Total11769100.00%92.70%

 

Why are the percentages using the measure not correct?

4 Replies

  • The issue is with the ALL function. Use this corrected measure:

     

    % of Shipment by PickupPerformance by Site =
    DIVIDE(
        SUM(TMSShipmentDetail[ShipmentCount]),
        CALCULATE(
            SUM(TMSShipmentDetail[ShipmentCount]),
            ALL(TMSShipmentDetail)
        )
    )

    This ensures the denominator uses the total shipment count without filters, matching Excel percentages. 

  • Hi TomSinAA  - check the denominator includes all rows, regardless of filters on any column

     

    use the below measure:

    % of Shipment by PickupPerformance by Site =
    DIVIDE(
    SUM(TMSShipmentDetail[ShipmentCount]),
    CALCULATE(
    SUM(TMSShipmentDetail[ShipmentCount]),
    ALL(TMSShipmentDetail)
    )
    )

     

    the above logic helps

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi TomSinAA 

     

    Could you please explain the calculation logic you need and provide relevant example data or table structures(exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.