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
Aretehealth
Regular Visitor

Percentage total is being calculated incorrectly in matrix (Using Drill down)

I have 2 columns 'Total OPD Visits' and 'EMR Filled'. I must calculate 'EMR Usage %' as 'EMR Filled'/Total OP Visits'.
Here's how my matrix is set up:

Aretehealth_2-1704957785150.png


The numbers on the 'Practitioner' level are correct. However, on the specialty level, it is just adding (or averaging) the practitioner-level numbers.


SPECIALTY:
Aretehealth_0-1704957706219.png

PRACTITIONER:

Aretehealth_1-1704957711835.png

Currently set to average.

Aretehealth_3-1704957925401.png


I want the specialty numbers to be the correct division, i.e. [EMR FILLED (for all practitioners under that specialty)] / [TOTAL OPD VISITS (for all practitioners under that specialty)].

I have tried various solutions presented by the community on similar issues:

 

 

EMR USAGE DETAIL% = 
DIVIDE (
    CALCULATE (
        SUM ( Detail_Conversion_Report[EMR_Filled] ),
        ALL ( Detail_Conversion_Report[Specialty], Detail_Conversion_Report[Practitioner] )
    )
    ,
    CALCULATE (
        SUM ( Detail_Conversion_Report[Total_OPD_Visits] ),
        ALL ( Detail_Conversion_Report[Specialty], Detail_Conversion_Report[Practitioner] )
    ),
    0
)


// SUM('Detail_Conversion_Report'[EMR_Filled])/SUM('Detail_Conversion_Report'[Total_OPD_Visits])

// CALCULATE(DIVIDE(Detail_Conversion_Report[EMR_FILLED_MEASURE], Detail_Conversion_Report[TOTAL_OPD_MEASURE]),
// ALLSELECTED(Detail_Conversion_Report[Specialty]))

// CALCULATE(DIVIDE(Detail_Conversion_Report[EMR_FILLED_MEASURE], Detail_Conversion_Report[TOTAL_OPD_MEASURE]),
// ALLSELECTED(Detail_Conversion_Report[Practitioner], Detail_Conversion_Report[Specialty]))

// IF(HASONEFILTER(Detail_Conversion_Report[Practitioner]),
// CALCULATE(
//             [EMR_FILLED_MEASURE],
//             ALL(Detail_Conversion_Report[Specialty])
//         )
//         /
//         CALCULATE(
//             [TOTAL_OPD_MEASURE],
//             ALL(Detail_Conversion_Report[Specialty])
//         )
//     ,
//     DIVIDE(Detail_Conversion_Report[EMR_FILLED_MEASURE], Detail_Conversion_Report[TOTAL_OPD_MEASURE])
    
// )
    

// IF(HASONEFILTER(Detail_Conversion_Report[Specialty]),
//     DIVIDE(Detail_Conversion_Report[EMR_FILLED_MEASURE], Detail_Conversion_Report[TOTAL_OPD_MEASURE]),
//     CALCULATE(
//             [EMR_FILLED_MEASURE],
//             ALL(Detail_Conversion_Report[Specialty])
//         )
//         /
//         CALCULATE(
//             [TOTAL_OPD_MEASURE],
//             ALL(Detail_Conversion_Report[Specialty])
//         )
// )
    


//  DIVIDE(Detail_Conversion_Report[EMR_FILLED_MEASURE], Detail_Conversion_Report[TOTAL_OPD_MEASURE])

// IF (
//     ISFILTERED (Detail_Conversion_Report[Practitioner]),
//     Detail_Conversion_Report[EMR_FILLED_MEASURE]
//     /
//     CALCULATE (
//         DIVIDE(Detail_Conversion_Report[EMR_FILLED_MEASURE], Detail_Conversion_Report[TOTAL_OPD_MEASURE]),
//         ALL (Detail_Conversion_Report[Practitioner])
//     )
// )

// IF (
//     NOT(ISFILTERED (Detail_Conversion_Report[Specialty])),
//         CALCULATE(
//             [EMR_FILLED_MEASURE],
//             ALL(Detail_Conversion_Report[Specialty])
//         )
//         /
//         CALCULATE(
//             [TOTAL_OPD_MEASURE],
//             ALL(Detail_Conversion_Report[Specialty])
//         )
// )


// IF(
//     Detail_Conversion_Report[Total_OPD_Visits] = 0,
//     0,
//     Detail_Conversion_Report[EMR_Filled] / Detail_Conversion_Report[Total_OPD_Visits]
// )

 

 



 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Aretehealth,

For measure expression get the wrong result when calculated on the total level with multiple aggregations, you can take a look at the following blog to know how to handle this scenario:

Measure Totals, The Final Word 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Aretehealth,

For measure expression get the wrong result when calculated on the total level with multiple aggregations, you can take a look at the following blog to know how to handle this scenario:

Measure Totals, The Final Word 

Regards,

Xiaoxin Sheng

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