
DAX Code PowerBI - Rolling Average Required
- or -
Post a project like this1351
£20(approx. $27)
- Posted:
- Proposals: 4
- Remote
- #3389792
- Awarded
Description
Experience Level: Entry
Hi. Still a beginner at DAX so any help would be much appreciated. I'm trying to get a rolling average of Product Distribution, but when I use the DAX codes I can find online for rolling averages, it creates an error as the date column contains duplicate dates. The code I'm trying to use is;
Product X Rolling 4Wk =
VAR NumDays = 28
VAR RollingSum =
CALCULATE(
SUM('Raw Data'[Product X In Store?]),
DATESINPERIOD('Raw Data'[Call Date],LASTDATE('Raw Data'[Call Date]),-NumDays,DAY)
)
RETURN
RollingSum/NumDays
Example of type of data is as follows. We show this as weekly average % distribution currently, but client has requested visibility of 4 week rolling average.
Call Date Store Name Product X In Store?
06/09/21 Store A 1
06/09/21 Store B 0
06/09/21 Store C 0
07/09/21 Store D 1
07/09/21 Store E 1
07/09/21 Store F 1
08/09/21 Store G 0
08/09/21 Store H 1
08/09/21 Store I 0
Any help would be greatly appreciated!
Product X Rolling 4Wk =
VAR NumDays = 28
VAR RollingSum =
CALCULATE(
SUM('Raw Data'[Product X In Store?]),
DATESINPERIOD('Raw Data'[Call Date],LASTDATE('Raw Data'[Call Date]),-NumDays,DAY)
)
RETURN
RollingSum/NumDays
Example of type of data is as follows. We show this as weekly average % distribution currently, but client has requested visibility of 4 week rolling average.
Call Date Store Name Product X In Store?
06/09/21 Store A 1
06/09/21 Store B 0
06/09/21 Store C 0
07/09/21 Store D 1
07/09/21 Store E 1
07/09/21 Store F 1
08/09/21 Store G 0
08/09/21 Store H 1
08/09/21 Store I 0
Any help would be greatly appreciated!

Martin R.
0% (0)Projects Completed
1
Freelancers worked with
1
Projects awarded
100%
Last project
11 Oct 2021
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies