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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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