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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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