Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Msk_2080
Frequent Visitor

Calculation of Financial YTD(starting from April till Marc) of a 3 month moving average of sales

I have calculated the last 3 months moving average of sales using the below calculation. 

3_month_moving_avg =
Var enddate = MAX(Sales_forescat[reporting_month])-1
var startdate = EDATE(enddate,-3)+1
var result =
CALCULATE(AVERAGE(Sales_forescat[Rolling_sales]),
DATESBETWEEN(Sales_forescat[reporting_month], startdate, enddate))
return
result
 
My intention now is to calculate the Financial YTD average of this 3_month_moving_avg . The calculation i am using is as below
 
YTD = CALCULATE([3_month_moving_avg],DATESYTD(Sales_forescat[reporting_month],"31/3"))
 
But the value is same as the value of 3_month_moving_avg. Please help me
 
reporting_monthRolling_sales3 month avgYTD rolling MonthYTD_Avg
4/1/2016 0:00415303969539695139695
5/1/2016 0:00568634030780002240001
6/1/2016 0:007028046029126031342010
7/1/2016 0:008148456224182255445564
8/1/2016 0:009669269542251797550359
9/1/2016 0:0011126482819334616655769
10/1/2016 0:0012791496480431096761585
11/1/2016 0:00142995111957543053867882
12/1/2016 0:00158568127391670444974494
1/1/2017 0:001726141431598136031081360
2/1/2017 0:001875471580599716621188333
3/1/2017 0:0020111217291011445721295381
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Msk_2080 ;

Please try it.

YTD = AVERAGEX(DATESYTD(Sales_forescat[reporting_month],"31/3"),[3_month_moving_avg])

The final output is shown below:

vyalanwumsft_0-1638249364919.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Msk_2080 ;

Please try it.

YTD = AVERAGEX(DATESYTD(Sales_forescat[reporting_month],"31/3"),[3_month_moving_avg])

The final output is shown below:

vyalanwumsft_0-1638249364919.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Usually when you calculate moving averages you do so based on the absolute values (monthly sales) , not the cumulative values.  It sounds like you want to take the average of the average of the cumulative values? Can you please confirm?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.