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

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

Reply
Blake753
Helper II
Helper II

Sum duplicate data only once per date measure

I have a dataset that is curretnly structured like this with some values repeating for the same date:

 

Employee nameDateHours
Hank8/26/20207
Hank8/26/20207
Hank8/25/20205.5
Sarah8/26/20209
Sarah8/26/20209
Sarah8/25/20208

 

I am trying to create a measure that sums the hours based on Unique Name and Date values.  For instance, the total for Hank here would be 12.5 (7+5.5) and 17 for Sarah (9+8).  I need the rows with duplicate dates to only be counted once towards the sum.  I cannot go in and delete that duplicate row either, it is needed for other purposes.  What is the best way to go about doing this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Here's probably the most simple way to calculate it. Maybe even easy to understand and most likely the fastest...

 

[Total] =
SUMX(
    SUMMARIZE(
        T,
        T[Employee Name],
        T[Date],
        T[Hours]
    ),
    T[Hours]
)

 

View solution in original post

5 REPLIES 5
Blake753
Helper II
Helper II

@Anonymous @amitchandak @Greg_Deckler I have the same question but I am looking to do a distinct count of employee names.  So instead of sum up the hours I need to count names.  My results from the orginal question would be 2 for Hank and 2 for Sarah.  

Anonymous
Not applicable

Here's probably the most simple way to calculate it. Maybe even easy to understand and most likely the fastest...

 

[Total] =
SUMX(
    SUMMARIZE(
        T,
        T[Employee Name],
        T[Date],
        T[Hours]
    ),
    T[Hours]
)

 

amitchandak
Super User
Super User

@Blake753 , Try a measure like

sumx(summarize(Table, table[Employee],Table[Date], "_1", Average(Table[Hours])),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

@Blake753 - Maybe:

Measure =
  VAR __Table = SUMMARIZE('Table',[Employee],[Date],"Hours",AVERAGE([Hours]))
RETURN
  SUMX(__Table,[Hours])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Seems to have worked, can you do a quick run through on how and why this worked?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.