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
Kratos_ZA
Helper I
Helper I

Calculate Monthly Average Sales Before and After Retail Store Relocation

Hi Friends,

 

Kindly assist with the below.

 

I have a few stores that have relocated/moved from one location to another. I would like to calculate the average sales before vs after the relocation. The issue is that the stores have different relocation dates: eg: Store 1 relocated on 2021-02-01 so i would calculate sales 12 months prior to 2021-02-01 and 12 months after 2021-02-01 an

 

The problem is that the dates are different for each store so i am unable to calculate the before and after sales average to see if there was a growth. Is there anyway around this instead of calculating manually in excel?

 

 

Store NameRelocation Date
Store 12021-02-01
Store 22021-06-01
Store 32021-09-01
Store 42022-11-01
Store 52022-02-01

 

SALES DONE
Store Name2020-01-012020-02-012020-03-012020-04-012020-05-012020-06-012020-07-012020-08-012020-09-012020-10-012020-11-012020-12-01
Store 1325434656456456456547575767
Store 2443566554334454353334
Store 33443565753454365354545
Store 44534545534353455435344354556
Store 55434453455657688734523454

 

1 REPLY 1
amitchandak
Super User
Super User

@Kratos_ZA , Try measure like

 


after 12 =
var _min = calculate(Min(Store[Relocation Dat]), allexcept(Store, Table[Store]))
var _max = date(year(_min), Month(_max)+12, Day(_min))
return
calculate(sum(Table[Amount]) , filter(Table, Table[date] <=_max && [date] >=_min))

 

or

after 12 =
var _min = calculate(Min(Store[Relocation Dat]), allexcept(Store, Table[Store]))

return

CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],_min ,12,MONTH))

 


before 12 =
var _max = calculate(Min(Store[Relocation Dat]), allexcept(Store, Table[Store]))
var _max = date(year(_min), Month(_max)-12, Day(_min))
return
calculate(sum(Table[Amount]) , filter(Table, Table[date] <=_max && [date] >=_min))

 

or

 

before 12 =
var _min = calculate(Min(Store[Relocation Dat]), allexcept(Store, Table[Store]))

return

CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],_min ,-12,MONTH))

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.

Top Solution Authors