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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Sum Start End Time Column

Hi there!

 

I have two tables and would like to sum between the start and end times.

 

My data is hourly like so:

 

Table1

DateValue
7/18/18 7:00 PM1
7/18/18 8:00 PM1
7/18/18 9:00 PM1
7/18/18 10:00 PM1
7/19/18 7:00 AM2
7/19/18 8:00 AM2
7/19/18 9:00 AM2
7/19/18 10:00 AM2
7/19/18 7:00 PM3
7/19/18 8:00 PM3
7/19/18 9:00 PM3
7/19/18 10:00 PM3

 

and I would like to sum as so:

 

Table2

StartEndSum
7/18/2018 7:00:00 PM7/19/2018 7:00:00 AM4
7/19/2018 7:00:00 AM7/19/2018 7:00:00 PM8
7/19/2018 7:00:00 PM7/20/2018 7:00:00 AM12

 

They are related by Start - Date.

 

Any thoughts?

 

Thanks!

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may use DAX below to add a calculated column.

Column =
SUMX (
    FILTER ( Table1, Table1[Date] >= Table2[Start] && Table1[Date] < Table2[End] ),
    Table1[Value]
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may use DAX below to add a calculated column.

Column =
SUMX (
    FILTER ( Table1, Table1[Date] >= Table2[Start] && Table1[Date] < Table2[End] ),
    Table1[Value]
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

This worked perfectly, thank you. Can you please provide it as a measure too?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.