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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ksquirt
New Member

Help with DAX, convert SUMIFS

I'm brand new to DAX and reasonably new to Power BI.  I'm trying to convert an Excel formula to Power BI.  Google is not quite helping with one piece.  I need to sum column D when there is a match in column E AND a match in column L.

 

Excel: =SUMIFS(D:D,E:E,E2,L:L,L2)

DAX: Sum of hours = CALCULATE(SUM('Timesheet Data May 2025 2025'[Units],(FILTER(all('Timesheet Data May 2025 2025'[Contractor User Name])),(FILTER(all('Timesheet Data May 2025 2025'[Work Date]))))))

1 ACCEPTED SOLUTION
v-dineshya
Community Support
Community Support

Hi @ksquirt ,

Thank you for reaching out to the Microsoft Community Forum.

 

please follow below steps.

1.  Created sample data based on inputs. refer snap.

vdineshya_0-1748595127692.png

2. Created measure "Sum of Hours Measure", As you are expecting, when User Name and  work date match, it will  sum the units.

 

Sum of Hours Measure =
CALCULATE(
SUM('Timesheet'[Units]),
FILTER(
ALL('Timesheet'),
'Timesheet'[Contractor User Name] = SELECTEDVALUE('Timesheet'[Contractor User Name]) &&
'Timesheet'[Work Date] = SELECTEDVALUE('Timesheet'[Work Date])
)
)
Please refer output snaps and PBIX file.

vdineshya_1-1748595386390.png

In that snap, For Contractor User Name (Alice), the sum of work date for Alice on May 1st 2025 is  9 (2+3+4)=9

The Result is as you expected.

 

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

 

View solution in original post

6 REPLIES 6
v-dineshya
Community Support
Community Support

Hi @ksquirt ,

Thank you for reaching out to the Microsoft Community Forum.

 

please follow below steps.

1.  Created sample data based on inputs. refer snap.

vdineshya_0-1748595127692.png

2. Created measure "Sum of Hours Measure", As you are expecting, when User Name and  work date match, it will  sum the units.

 

Sum of Hours Measure =
CALCULATE(
SUM('Timesheet'[Units]),
FILTER(
ALL('Timesheet'),
'Timesheet'[Contractor User Name] = SELECTEDVALUE('Timesheet'[Contractor User Name]) &&
'Timesheet'[Work Date] = SELECTEDVALUE('Timesheet'[Work Date])
)
)
Please refer output snaps and PBIX file.

vdineshya_1-1748595386390.png

In that snap, For Contractor User Name (Alice), the sum of work date for Alice on May 1st 2025 is  9 (2+3+4)=9

The Result is as you expected.

 

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

 

This worked!  Thank you so much!

bhanu_gautam
Super User
Super User

@ksquirt Try Using

 

dax
Sum of hours =
CALCULATE(
SUM('Timesheet Data May 2025 2025'[Units]),
FILTER(
'Timesheet Data May 2025 2025',
'Timesheet Data May 2025 2025'[Contractor User Name] = EARLIER('Timesheet Data May 2025 2025'[Contractor User Name]) &&
'Timesheet Data May 2025 2025'[Work Date] = EARLIER('Timesheet Data May 2025 2025'[Work Date])
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks!  It looks like it's adding Units where the User Name is the same, but not the work date.  I need it to sum the units when both matches.

 

What does 'Earlier' do exactly?

@ksquirt 

Returns the current value of the specified column in an outer evaluation pass of the mentioned column.

EARLIER is useful for nested calculations where you want to use a certain value as an input and produce calculations based on that input.

 

Try using

dax
Sum of hours =
CALCULATE(
SUM('Timesheet Data May 2025 2025'[Units]),
FILTER(
'Timesheet Data May 2025 2025',
'Timesheet Data May 2025 2025'[Contractor User Name] = EARLIER('Timesheet Data May 2025 2025'[Contractor User Name]) &&
'Timesheet Data May 2025 2025'[Work Date] = EARLIER('Timesheet Data May 2025 2025'[Work Date])
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






It seems to be adding the units everytime the user name changes.  

 

ksquirt_0-1748544942271.png

 

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.

Top Solution Authors