The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi There,
I'm trying to calculate the daily average of all calls offered, I started off by doing a sum but couldn't figure out how to then divide the sum by the count of column values for the period. I have included my DAX formula in terms of where I got up to. Please let me know if there's even a better way of doing this. Many thanks
Solved! Go to Solution.
To calculate the daily average of all calls offered based on your existing DAX formula, you essentially want to divide the sum of calls offered by the number of days in the period. Your formula correctly sums the calls offered but does not account for the number of days over which to average.
AvgWTDCallsOffered =
VAR TotalCallsOffered = CALCULATE(
SUM('Call Data'[Offered]),
FILTER(
ALL(CDCalendar),
(CDCalendar[Last7Days] = MAX(CDCalendar[Last7Days])) &&
(CDCalendar[CallDate] <= MAX(CDCalendar[CallDate]))
)
)
VAR CountOfDays = CALCULATE(
DISTINCTCOUNT(CDCalendar[CallDate]),
FILTER(
ALL(CDCalendar),
(CDCalendar[Last7Days] = MAX(CDCalendar[Last7Days])) &&
(CDCalendar[CallDate] <= MAX(CDCalendar[CallDate]))
)
)
RETURN
DIVIDE(TotalCallsOffered, CountOfDays)
If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍
To calculate the daily average of all calls offered based on your existing DAX formula, you essentially want to divide the sum of calls offered by the number of days in the period. Your formula correctly sums the calls offered but does not account for the number of days over which to average.
AvgWTDCallsOffered =
VAR TotalCallsOffered = CALCULATE(
SUM('Call Data'[Offered]),
FILTER(
ALL(CDCalendar),
(CDCalendar[Last7Days] = MAX(CDCalendar[Last7Days])) &&
(CDCalendar[CallDate] <= MAX(CDCalendar[CallDate]))
)
)
VAR CountOfDays = CALCULATE(
DISTINCTCOUNT(CDCalendar[CallDate]),
FILTER(
ALL(CDCalendar),
(CDCalendar[Last7Days] = MAX(CDCalendar[Last7Days])) &&
(CDCalendar[CallDate] <= MAX(CDCalendar[CallDate]))
)
)
RETURN
DIVIDE(TotalCallsOffered, CountOfDays)
If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍
This has worked perfectly, thank you so much!