Forum Discussion
Calculate a weekly average from measures based on multiple columns
Hi SimonJacobs,
In your screentshot, the date 20/01/2017 week begining date is 19/06/2017? What does this mean? Which week total do you need to calculated? Which week average do you need to calculated?
Please providue us more information about you expected result, so that we can make further analysis.
Regards,
Charlie Liao
Hi Charlie,
Ah that's a Typo. I've amended in the photo below.
What I'm looking to do is sum the interactions for each day (e.g. summing all columns on the 23/1/17 gives 828,027 interactions. Then sum the total interactions across the week (so 1.7m for week beginning 23/1/17) then work out the average weekly number across all weeks in a defined period -so in the example above summing the total interactions for the weeks 23/1 and 30/1 then dividing by 2 to give 2,269,401 interactions.
Since posting this I tried creating a summary table using the syntax below:
Weekly Interactions =
SUMMARIZE(
'Weekly Interactions',
DateRef[WeekBeginning],
"Total Weekly Interactions",
sum('Social Data'[Total Interactions]),
"Number of days in week",
count('Top Gear'[Total TG Interactions])
)
'Social Data' is the name of the table show in the image, 'DateRef' is my date table shown in the image above and 'Total Interactions' is a column I added to sum the interactions across all columns shown above. I also added the 'number of days in week' column in the summary table so I can later filter out any partial weeks due to data updates occuring mid-week.
From the summary table I calculated the weekly average using the measure below:
.Avg Weekly Interactions = AVERAGEX(FILTER('Weekly Interactions','Weekly Interactions'[Number of days in week] = 7),'Weekly Interactions'[Total Weekly Interactions]).
This seems to be working but I'm keen to know if this is a bit long-winded or if there are any better solutions.