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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Kasunpathirana
Advocate IV
Advocate IV

How to achieve SUMPRODUCT result in Excel using DAX

Below I have shown my sample data and the expected result. In excel it's pretty much straight forward.

 

My challenge is how we use DAX to accomplish this I have created a DATE table and the rest of the Item records imported.

I was looking for help on how to achieve this using DAX. 🙂 

 

 

sumproduct.png

1 ACCEPTED SOLUTION
Kasunpathirana
Advocate IV
Advocate IV

There are few ways to achieve this. 

 

I should Thank @marcorusso@MarcelBeug and @Phil_Seamark for the wonderful content.

 

Below is my source:

 

Resource Requirement.png

 

Below Result Can be Achieved from the M and DAX Code 

Matrix.png

 

 

You can use either M or DAX I prefer the M way which is faster but it can also be solved using DAX.

 

For the M Code you can refer the post https://community.powerbi.com/t5/Desktop/Convert-date-ranges-into-list-of-dates/td-p/129418 and find @MarcelBeug video 

 

Below is the DAX Code I used this helps to expand the table by the Start Date and End Date. 

 

Resource Requirement  Expanded =
SUMMARIZE(
GENERATE(
'Resource Requirement',
CALCULATETABLE(
VALUES('Date'[Date]),
DATESBETWEEN('Date'[Date],'Resource Requirement'[Start Date],'Resource Requirement'[End Date])
)
),
'Date'[Date],
'Resource Requirement'[Project],
'Resource Requirement'[Required Number of Resources Per Day]
)

 

If you are only looking at a DAX Measure you can use below. (Note Only can use to sum up the daily Resource Requirement if want to achieve the Matrix need to use above DAX Code. Thanks to @marcorusso for this guidng me for this. 

Also recommend to read SQLBI Article https://www.sqlbi.com/articles/analyzing-events-with-a-duration-in-dax/

 

Utilization Measure =
VAR SelectedDay = SELECTEDVALUE ( 'Date'[Date] )
RETURN
CALCULATE
(
SUM ( 'Resource Requirement'[Required Number of Resources Per Day]),
'Resource Requirement'[Start Date]<= SelectedDay,
'Resource Requirement'[End Date] >= SelectedDay,
ALL ( 'Resource Requirement'[Required Number of Resources Per Day]) )

 

Love the Power BI Community. 

View solution in original post

5 REPLIES 5
Kasunpathirana
Advocate IV
Advocate IV

There are few ways to achieve this. 

 

I should Thank @marcorusso@MarcelBeug and @Phil_Seamark for the wonderful content.

 

Below is my source:

 

Resource Requirement.png

 

Below Result Can be Achieved from the M and DAX Code 

Matrix.png

 

 

You can use either M or DAX I prefer the M way which is faster but it can also be solved using DAX.

 

For the M Code you can refer the post https://community.powerbi.com/t5/Desktop/Convert-date-ranges-into-list-of-dates/td-p/129418 and find @MarcelBeug video 

 

Below is the DAX Code I used this helps to expand the table by the Start Date and End Date. 

 

Resource Requirement  Expanded =
SUMMARIZE(
GENERATE(
'Resource Requirement',
CALCULATETABLE(
VALUES('Date'[Date]),
DATESBETWEEN('Date'[Date],'Resource Requirement'[Start Date],'Resource Requirement'[End Date])
)
),
'Date'[Date],
'Resource Requirement'[Project],
'Resource Requirement'[Required Number of Resources Per Day]
)

 

If you are only looking at a DAX Measure you can use below. (Note Only can use to sum up the daily Resource Requirement if want to achieve the Matrix need to use above DAX Code. Thanks to @marcorusso for this guidng me for this. 

Also recommend to read SQLBI Article https://www.sqlbi.com/articles/analyzing-events-with-a-duration-in-dax/

 

Utilization Measure =
VAR SelectedDay = SELECTEDVALUE ( 'Date'[Date] )
RETURN
CALCULATE
(
SUM ( 'Resource Requirement'[Required Number of Resources Per Day]),
'Resource Requirement'[Start Date]<= SelectedDay,
'Resource Requirement'[End Date] >= SelectedDay,
ALL ( 'Resource Requirement'[Required Number of Resources Per Day]) )

 

Love the Power BI Community. 

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Kasunpathirana,

 

From above screenshot, which is source data? Which is desired result that returned by SUMPRODUCT? Also, could you please illustrate the expression you used above to help us better understand the calculation rule?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the Reply  @v-yulgu-msft the source data is the one label as Data. 

 

Then I'm expecting the result which is shown on top as result. In excel if use SUMPRODUCT can achieve this result. 

 

 

SivaMani
Resident Rockstar
Resident Rockstar

Please refer the below DAX function,

 

SUMX() - https://msdn.microsoft.com/en-us/query-bi/dax/sumx-function-dax

 

@SivaMani I'm familiar with this funcion. But so far using SUMX() I'm not able to achieve this. Is it possible for you to send the full code to get the result shown.

 

You can use my sample data to show case. Man Happy

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.