Forum Discussion
Jorgast
7 years agoResolver II
Division in a Measure
Hello BI Community, I am trying to get an average of sales offered for 2018 and 2019 by week and have that average be constant in a line/bar chart. I have a date table setup where i have the week...
- 7 years ago
It looks like you're getting the correct numerator value because you're using the ALLEXCEPT to change the filter context, but you're not doing the same for the denominator.
Try this so that you're applying the same context changes to both halves of the equation:
Avg Sales2018 = CALCULATE(sum('Sample Data'[Sales_Offered])/[Count of WeekNum], "2018", ALLEXCEPT(Dates, Dates[Date]))
Cmcmahan
7 years agoResident Rockstar
It looks like you're getting the correct numerator value because you're using the ALLEXCEPT to change the filter context, but you're not doing the same for the denominator.
Try this so that you're applying the same context changes to both halves of the equation:
Avg Sales2018 = CALCULATE(sum('Sample Data'[Sales_Offered])/[Count of WeekNum], "2018", ALLEXCEPT(Dates, Dates[Date]))