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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
efowler
Helper II
Helper II

Distinct Count when looking at multiple fields in table

Hello...  I have a long standing challange to properly calucate what I call "Distinct Repair".   I have a sample data table attached which shows the overall data and column E shows what would be considered a Count = 1.  My notes are below and this data is related to repair data on a product. 

 

Goal = To count distinct repairs in which there are more than one rows (unique Claim #) for the same product on the same date with same repair part. 

 

Challange = A single repair can show in the data set as two rows each with a unique claim #.  When the Product Serial #, PFP, and Repair Date are all the same between the two row it should be counted a Distinct Repair = 1

 

Any ideas on how to write the DAX for this? 

LINK TO SAMPLE DATA SET 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @efowler 

Please check if formula below could help:

Result =
VAR min_Claim =
    MINX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Product SN] = EARLIER ( 'Table'[Product SN] )
                && 'Table'[PFP] = EARLIER ( 'Table'[PFP] )
                && 'Table'[Repair Date] = EARLIER ( 'Table'[Repair Date] )
        ),
        'Table'[Claim #]
    )
RETURN
    IF ( 'Table'[Claim #] = min_Claim, 1, BLANK () )

veasonfmsft_0-1669960735610.png

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @efowler 

Please check if formula below could help:

Result =
VAR min_Claim =
    MINX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Product SN] = EARLIER ( 'Table'[Product SN] )
                && 'Table'[PFP] = EARLIER ( 'Table'[PFP] )
                && 'Table'[Repair Date] = EARLIER ( 'Table'[Repair Date] )
        ),
        'Table'[Claim #]
    )
RETURN
    IF ( 'Table'[Claim #] = min_Claim, 1, BLANK () )

veasonfmsft_0-1669960735610.png

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Works perfect, thank you!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors