Forum Discussion

VModani's avatar
VModani
Frequent Visitor
4 years ago
Solved

How to avoid double counting when an item links to multiple items in a different column

I have data that among other things contains names and Offer/Reject action. I want to find how many names are in each action Reject or Accept. I can create 2 seperate measures for both actions and do...
  • Jihwan_Kim's avatar
    4 years ago

    Hi, 

    I am not quite sure which action does Mike belong to. On the same day, Mike's result is Reject and Offer.

    I guess Mike belongs to both, and the below calculation shows like this.

     

    Please check the attached pbix file.

     

     

    Distinctcount name by last action only: =
    IF (
    HASONEVALUE ( Data[Action] ),
    CALCULATE (
    COUNTROWS ( Data ),
    TREATAS (
    GROUPBY (
    ALL ( Data ),
    Data[Name],
    "@lastactiondate", MAXX ( CURRENTGROUP (), Data[Date] )
    ),
    Data[Name],
    Data[Date]
    )
    )
    )