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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
nawillia711
Helper I
Helper I

Calculate sum by Dates in New Table

I have two tables. One has many values for each day. The other has one value for each day. I am trying to sum the values from each day in the first table to the second table. For example:

If table 1 looked like this:

12/31/2019 4:00 AM1
12/31/2019 8:37 PM0.89
1/1/2020 5:00 PM0.99
1/3/2020 6:07 AM12
1/3/2020 8:00 PM3

 

Then table 2 would look like this:

12/31/20191.89
1/1/20200.99
1/2/20200
1/3/202015

 

I have connected the tables with a one to many relationship and have used this formula before, with other sources to get this result: Calculate(Sum('Table 1'[Column 1])) but am unable to get it to work on this particular data source. I have tried as many relationships as I can, just can't seem to get this one to work. Is there any other way to get this to work?

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @nawillia711 

I see 2 option

 

1. easy:

drop relationships, create new table

NewTable = UNION(Table1, Table2)

then summarize in visual

 

2. more classical

create a calendar table

CalendarTable = CALENDARAUTO()

add a column into Table1

OnlyDate = DATEVALUE(Table1[Date])

add relationships between CalendarTable and Table1 by new OnlyDate field and between CalendarTable and Table2 by field Date

then add final column into CalendarTable

Column = CALCULATE(SUM(Table1[Value])+SUM(Table2[Value]))

  


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

6 REPLIES 6
az38
Community Champion
Community Champion

Hi @nawillia711 

I see 2 option

 

1. easy:

drop relationships, create new table

NewTable = UNION(Table1, Table2)

then summarize in visual

 

2. more classical

create a calendar table

CalendarTable = CALENDARAUTO()

add a column into Table1

OnlyDate = DATEVALUE(Table1[Date])

add relationships between CalendarTable and Table1 by new OnlyDate field and between CalendarTable and Table2 by field Date

then add final column into CalendarTable

Column = CALCULATE(SUM(Table1[Value])+SUM(Table2[Value]))

  


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Mariusz
Community Champion
Community Champion

Hi @nawillia711 

 

What fields do you use for your relationship

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

I use the date columns as the field.

Hi @nawillia711 

 

Do both tables contain date or is one of them datetime?

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

I have tried both of them being date/time and the one I am going to being date and the one I'm coming from being date/time. 

Hi @nawillia711 

 

Add an extra column in the table with date-time (duplicate of Date-Time column ) and format it to date, later use it to build a relationship.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.