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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
VModani
Frequent Visitor

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 distinctcount to count each individually. But that results in some doublecounting as some name are first reject and then offered so are counted seperately. 

 

I want to count them seperately only but need to remove if they were in the other action before.

 

Take John as an example below. He appears 4 times, 2 reject and 2 offered. I created a measure of Distinctcount and filtered by action. so I get 1 in offer and 1 in reject. I only want 1, based on the newest entry.

 

Thanks!!

 

DateNameAction
1 FebJohnReject
1 FebJohnReject
2 FebAdamReject
2 FebRobertOffer
3 FebJohnOffer 
4 FebMikeReject
4 FebMikeOffer
5 FebJohnOffer

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

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.

 

Picture1.png

 

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]
)
)
)
 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

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.

 

Picture1.png

 

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]
)
)
)
 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Sorry for not making the sample properly. Mike belongs to the Offered action. I think date/time datatype can solve that. The solution itself if working. Thank You!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.