cancel
Showing results for 
Search instead for 
Did you mean: 
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.

View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.