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
TaylorLile
Frequent Visitor

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!

 

1 ACCEPTED SOLUTION

@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.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@TaylorLile 

Try like

Total Eligibilities = CALCULATE(DISTINCTCOUNT('Patient Conditions'[Diagnosis]),ALLEXCEPT('Patient Conditions','Patient Conditions'[Status]),'Patient Conditions'[Status]= "Eligible")

 

Also, this gives a good example to deal with subtotal :https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390

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

@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.

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.