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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
abhishekc1
Frequent Visitor

calculate n days sales for locations with different start dates

Hi All,

 

Could you please help me out with this? My data is setup in the following way:

 

a) Data table - contains order date, location name, customer id,  product name, quantity, amount and order id

b) Calendar table - date table that is connected to the data table 

c) Locationkey - contains locations and their respective start dates

for example: 

Location Start Date
Loc 19/1/2017
Loc 211/1/2017
Loc 32/2/2018
Loc 43/5/2018
Loc 57/6/2018
Loc 610/10/2018
Loc 712/22/2018
Loc 82/2/2019
Loc 97/4/2019
Loc 1017/6/2019

 

The expected result that would help me further would be:

 

Location 1st week sales2nd week sales3rd week sales4th week sales5th week sales6th week sales7th week sales8th week sales9th week sales10th week sales11th week salesnth week sales
Loc 1            
Loc 2            
Loc 3            
Loc 4            
Loc 5            
Loc 6            
Loc 7            
Loc 8            
Loc 9            
Loc 10            

 

1st week sales would be sales for the first week after the launch date.

 

Thanks 

 

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

Hi @abhishekc1 ,

 

Please check the following steps as below.

 

1. To creat a date table and insert a calculated column in it.

DATE = CALENDARAUTO()
Column = WEEKNUM('DATE'[Date]) & "WEEK" & YEAR('DATE'[Date])

2. Create relationship between date table and Locationkey table.

 

3. Then we can create a matrix as below.

 

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

1 REPLY 1
v-frfei-msft
Community Support
Community Support

Hi @abhishekc1 ,

 

Please check the following steps as below.

 

1. To creat a date table and insert a calculated column in it.

DATE = CALENDARAUTO()
Column = WEEKNUM('DATE'[Date]) & "WEEK" & YEAR('DATE'[Date])

2. Create relationship between date table and Locationkey table.

 

3. Then we can create a matrix as below.

 

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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