Forum Discussion
Average Sales between 2016-2020 DAX Measure
Hi Experts
I am trying to work out the avergae sales between two years i.e. 2016-2020 my measure is
2016-2020 Average = Calculate(average(Sales[Sales Amt]), DATESYTD(ENDOFYEAR(DATEADD(Dim[Date],-4,YEAR)),"12/31"))
not sure the abpve is correct
Hi Anonymous ,
In my test, your dax measure is correct.
My test table:
Dim table:
Measure:
2016-2020 Average = Calculate(average(Sales[Sales Amt]), DATESYTD(ENDOFYEAR(DATEADD(Dim[Date],-4,YEAR)),"12/31"))Result:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- lbendlin
Super User
Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 - v-yadongf-msft
Community Support
Hi Anonymous ,
In my test, your dax measure is correct.
My test table:
Dim table:
Measure:
2016-2020 Average = Calculate(average(Sales[Sales Amt]), DATESYTD(ENDOFYEAR(DATEADD(Dim[Date],-4,YEAR)),"12/31"))Result:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.