Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello community,
I have the following (simplified) data. I want to calculate the average of three years based on below table and show that value for the according year:
Year | YearQuarter | Value |
2013 | 2013-01 | 20 |
2013 | 2013-02 | 40 |
2013 | 2013-03 | 35 |
2013 | 2013-04 | 10 |
2014 | 2014-01 | 44 |
2014 | 2014-02 | 16 |
2014 | 2014-03 | 15 |
2014 | 2014-04 | 10 |
2015 | 2015-01 | 61 |
2015 | 2015-02 | 35 |
2015 | 2015-03 | 22 |
2015 | 2015-04 | 20 |
And this would be the expected output for 2015:
Year | Value | Average of 3 years |
2013 | 105 | … |
2014 | 85 | … |
2015 | 138 | 109 |
109 = (105 + 85 + 138) / 3
I hope you have an idea here because I am stuck.
Thank you.
Solved! Go to Solution.
Hi, @tonyclifton
Please check the below picture and the sample pbix file's link down below.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, @tonyclifton
Please check the below picture and the sample pbix file's link down below.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hey @tonyclifton ,
depending if you want to calculate whole years or from the max date or filter date you can use different approaches.
Check the function DATESINPERIOD function (DAX) - DAX | Microsoft Docs or PARALLELPERIOD function (DAX) - DAX | Microsoft Docs that can both extend the filter context of your date to 3 years.
Also be aware you need a proper date table in order to make the time intelligence functions work:
https://softcrylic.com/blogs/power-bi-for-beginners-how-to-create-a-date-table-in-power-bi/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |