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

Calculate weekly sum from different tables

Hi,

 

I'm a newbe for Power BI and can't see how to solve this calculation.

 

I have different tables:

 

Table 1:   has arrival_date and amount fields

Table 2:  Calendar table, includes weeknumber of year

Table 3:  I need to calculate the weekly sum for the amount in table 1 (at the end of the week) and show, and also compare each weekly sum with last week's sum.

 

Example:  

 

TABLE 1

DateReservationAmount
1/5/2021123100
2/5/2021234200
5/5/20211234150
8/5/20211236300

 

TABLE 2

DateWeekNum
1/5/202117
2/5/202117

3/5/2021

18
4/5/202118
6/5/202118
7/5/202118
8/5/202118

 

TABLE 3

 

DATEWEEKNRWEEKLY_SUMDIFF_LAST_WEEK
1/5/202117100-
2/5/202117300-
3/5/2021180

-300

4/5/2021180-300
5/5/202118150-150
6/5/202118

150

-150
7/5/202118150-150
8/5/202118450150

 

How can I achieve this? 

 

Do I have to do that in Transform Data > Add columns (Power Query, right?)

 

Or can I do it with DAX from the main Power Desktop Menu adding a new table and columns? 

 

Thanks a lot in advance for all your help! 🙂

 

Regards,

 

Victor. 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I suggest doing by DAX measure.

Please check the below picture and the sample pbix file's link down below.

All measures are in the sample pbix file, and all steps are numbered in front of each measure.

 

 

Picture19.png

 

https://www.dropbox.com/s/tw6eiw0quw5ba7f/vicgonsam.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Wow..this was fast. And efficient! 

 

Thanks a lot!  No wonder why you're a Community Champion! 🙂

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I suggest doing by DAX measure.

Please check the below picture and the sample pbix file's link down below.

All measures are in the sample pbix file, and all steps are numbered in front of each measure.

 

 

Picture19.png

 

https://www.dropbox.com/s/tw6eiw0quw5ba7f/vicgonsam.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.