Forum Discussion

Aretehealth's avatar
Aretehealth
Regular Visitor
2 years ago
Solved

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:


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


SPECIALTY:

PRACTITIONER:

Currently set to average.


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]
// )

 

 



 

  • Anonymous's avatar
    Anonymous
    2 years ago

    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

1 Reply

  • Anonymous's avatar
    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