March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello:
I'm seeking input on how to calculate (efficiently) a daily average for sales for two weeks (can be a month) before and two weeks after a promotional period. The promotional period example is in a separate table called Ad_Campaigns. Here is a shot of the info:
Campaign | Start | End | Marketing Spend | Brand | Year | Discount% |
Spring-Easter -5% Off | 3/29/2020 | 4/11/2020 | $ 660 | LookSharp | 2020 | 0.05 |
Spring-Easter -5% Off | 3/29/2020 | 4/11/2020 | $ 396 | SmoothDrive | 2020 | 0.05 |
Spring-Easter -5% Off | 3/29/2020 | 4/11/2020 | $ 396 | Stealth | 2020 | 0.05 |
Spring-Easter -5% Off | 3/29/2020 | 4/11/2020 | $ 1,848 | ZEGO | 2020 | 0.05 |
I'm able to figure out how to calculate sales during this period but combining two periods to get an average is my question.
I have a date table and sales table. I'll paste below. Thanks much!
Hi @Whitewater100 ,
you can drop your file to attach.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Polly:
Please find the file. Thank you for your assistance.
Hi @Whitewater100 ,
I have created a simple sample. Please refer to it to see if it helps you.
Measure
= var national_= IF(SELECTEDVALUE('Table'[date])>=DATE(2021,10,1)&&SELECTEDVALUE('Table'[date])<=DATE(2021,10,7),"National day",BLANK())
var result = CALCULATE(AVERAGE('Table'[Marketing]),FILTER(ALL('Table'),ISBLANK(national_)))
var holiday_average= CALCULATE(AVERAGE('Table'[Marketing]),FILTER(ALL('Table'),'Table'[date]>=DATE(2021,10,1)&&'Table'[date]<=DATE(2021,10,7)))
return
IF(SELECTEDVALUE('Table'[date])>=DATE(2021,10,1)&&SELECTEDVALUE('Table'[date])<=DATE(2021,10,7),holiday_average,result)
If I have misunderstand your meaning, pleasae provide your pbix without privacy information and desired output.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello:
I had planned to attach my file, however, I do not see where to attach my file here. Can you tell me the best way to send?
Thank you
Hello and thank you:
For example the Fall 2021 Ad is from 10-30-21 to 11-19-21.
I take a measure for two weeks before and two weeks after.
Hi @Whitewater100 ,
If your formula works well, please have a try.
Fall '21 Base=
var Fall'21 Pre-Ad AUPD =
CALCULATE (
AVERAGEX ( Dates, [Units] ),
DATESBETWEEN ( Dates[Date], DATE ( 2021, 10, 16 ), DATE ( 2021, 10, 29 ) )
)
var Fall'21 Post-AD AUPD =
CALCULATE (
AVERAGEX ( Dates, [Units] ),
DATESBETWEEN ( Dates[Date], DATE ( 2021, 11, 20 ), DATE ( 2021, 12, 4 ) )
)
return
(Fall'21 Post-AD AUPD- Fall'21 Pre-Ad AUPD)/2
If I have misunderstood your meaning, please provide your pbix without privacy information and desired output.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Whitewater100 , if you already have a sales measure for the period. you can try a measure
averaged(values('Date'[Date]), [sales period])
Thank you for replying. I have the sales periods (Pre & Post) promotion. e.g,
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |