Forum Discussion

TaylorLile's avatar
TaylorLile
Frequent Visitor
6 years ago
Solved

Total Count by ID and Another Column

Hello,

 

I have the following table: 

 

IDDiagnosisSourceStatus
1AClaimsEligible
1BMedcationEligible
1CNULLNot Eligible
2ANULLNot Eligible
2BClaimsEligible
2CNULLNot Eligible
3AMedcationEligible
3BNULLNot Eligible
3CClaimsEligible

 

I'm trying to add a Total Eligibilities by ID Column (Note: A Source of NULL means they are not Eligible) like so:

 

IDDiagnosisSourceStatusTotal Eligibilities
1AClaimsEligible2
1BMedcationEligible2
1CNULLNot Eligible2
2ANULLNot Eligible1
2BClaimsEligible1
2CNULLNot Eligible1
3AMedcationEligible2
3BNULLNot Eligible2
3CClaimsEligible2

 

I have tried the following with no success: 

Total Eligibilities = CALCULATE(DISTINCTCOUNT('Patient Conditions'[Diagnosis]),ALLEXCEPT('Patient Conditions','Patient Conditions'[Status]),ALLEXCEPT('Patient Conditions','Patient Conditions'[ID]))
 
I'm obviously missing something, but am not sure what.
 
Any help would be appreciated. Thanks!

 

  • TaylorLile 

    Make sure you are using do not summarize on Id column when you put to the table

     

    Measure = CALCULATE(COUNTROWS(FILTER(Sheet1,Sheet1[Status]="Eligible")),ALLEXCEPT(Sheet1,Sheet1[ID]))

     

     

    Pbix is attached after signature.

    if you need more help make me @

    Appreciate your Kudos.

3 Replies

    • TaylorLile's avatar
      TaylorLile
      Frequent Visitor

      Thanks, for the response amitchandak. That gets me closer, but it is now only giving me the distinct number of diagnosis with a status of "Eligible" for the entire dataset, not by ID. I tried added another ALLEXCEPT function including the ID, but that didn't change anything. 


      Thanks for the link, I'll look at that now as well. 


      Appreciate the help!


      -Taylor

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        TaylorLile 

        Make sure you are using do not summarize on Id column when you put to the table

         

        Measure = CALCULATE(COUNTROWS(FILTER(Sheet1,Sheet1[Status]="Eligible")),ALLEXCEPT(Sheet1,Sheet1[ID]))

         

         

        Pbix is attached after signature.

        if you need more help make me @

        Appreciate your Kudos.