Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
2 years ago
Solved

Counting Duplicates in a Table with DAX

Hello everyone.

I have tried in several ways to count duplicates in a table but as the record is repeated the count progresses.

An example

Thank you in advance

Best regards!

5 Replies

  • Try this measure

     

    row count = 
    CALCULATE(
        COUNTROWS(yourdata),
        ALLEXCEPT(yourdata,yourdata[ID]))

     

     

    Thanks for the clear description of the problem with example data. I wish everyone did that!

    Remember we are unpaid volunteers, and you have got free expert help which took a lot of effort,
    This solution works and does exactly what you asked.
    So please quickly click the [accept as solution] and the thumbs up button to leave kudos. 

    One question per ticket please. If you need to change or extend your request then please raise a new ticket.

    You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

    If you quote speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

    Please now click the [accept as solution] and the thumbs up button.  Thank you.

     

  • Thank you Master!!

    In excel it's not hard to do it, in fact I did, but taking it to Dax I didn't know..

    Thank you very much

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Syndicate_Admin 

    Based on your description, I have created a measure to achieve the effect you are looking for. Following picture shows the effect of the display.

     

     

     

    Measure:

    Counts =
    
    VAR _Counts =
    
        COUNTAX (
    
            FILTER ( ALL ( 'Table' ), 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] ) ),
    
            'Table'[ID]
    
        )
    
    RETURN
    
        _Counts

    If this does not work, could you please share some sample data without sensitive information and expected output.
    How to provide sample data in the Power BI Forum - Microsoft Fabric Community

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

     

     

  • @Syndicate_Admin

    please be polite and promptly click "accept as solution" and the thumbs up buttons.

    Remeber that we are unpaid volunteers and you might wnat help again.😁