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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
szub
Helper III
Helper III

Getting a distinct count of records based on criteria

Hi,

 

I am trying to find how to get a distinct count of records that contain certain criteria.  Below is sample data.  I need a "Claim" number to be counted once to if "Adjsted by Line" is "Yes" on one or more lines.  Ultimately I want to use this to get a percentage of claims that had had an adjustment.  Right now I can only get it by percentage of lines since there can be multiple lines on a claim. 

 

I have tried to use the following formula, but when I export a table to Excel to validate the numbers, it is not correct and providing a higher count:  Adjusted Claim = IF('TABLE 1'[Labor Adjusted by Line]="Yes",CALCULATE(DISTINCTCOUNT(TABLE 2[Claim #])))

 

Claim #TypeRequest QtyApproved QtyAdjusted by Line
1HOURLY115Yes
1MILEAGE5050No
1TRAVEL1.251.25No
2HOURLY11No
2HOURLY33No
3HOURLY86Yes
3MILEAGE100100No
3TRAVEL22No
4HOURLY64Yes
4MILEAGE125100Yes
4TRAVEL22No

 

I appreciate any guidance.

 

Regards

2 ACCEPTED SOLUTIONS
jdbuchanan71
Super User
Super User

Hello @szub 

We need just a couple measures.  First, one to just count the distinct claims.

Claim Count = DISTINCTCOUNT ( 'Table'[Claim #] )

Then we can do one to count just the adjusted claims.

Adjusted Claim Count = 
CALCULATE (
    [Claim Count],
    'Table'[Adjusted by Line] = "Yes"
)

And finally the % of adjusted claims.

Adjusted Claim % = DIVIDE ( [Adjusted Claim Count], [Claim Count] )

ClaimCount.jpg

View solution in original post

amitchandak
Super User
Super User

Can you try like

CALCULATE(DISTINCTCOUNT(TABLE 2[Claim #]), filter('TABLE 1','TABLE 1'[Labor Adjusted by Line]="Yes"))

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

Can you try like

CALCULATE(DISTINCTCOUNT(TABLE 2[Claim #]), filter('TABLE 1','TABLE 1'[Labor Adjusted by Line]="Yes"))

jdbuchanan71
Super User
Super User

Hello @szub 

We need just a couple measures.  First, one to just count the distinct claims.

Claim Count = DISTINCTCOUNT ( 'Table'[Claim #] )

Then we can do one to count just the adjusted claims.

Adjusted Claim Count = 
CALCULATE (
    [Claim Count],
    'Table'[Adjusted by Line] = "Yes"
)

And finally the % of adjusted claims.

Adjusted Claim % = DIVIDE ( [Adjusted Claim Count], [Claim Count] )

ClaimCount.jpg

@jdbuchanan71 Thank you - this worked too!

@amitchandak Thank you so much, this worked!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.