Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi there,
Can anyone help with a query related to my previous one...trying to retrieve a calculated average value for a base year, next to the selected later dates, and to be compatible with filters and selections. eg. For compare Aug-24 Average value to Average Value for Aug-19, or for Jan-Aug 2024 Average compared to Average for Jan-Aug 2019, and to pull the same for Category (in this case the poast code)
See sample .pbix and data:
Using the following DAX brings back the correct 2019 Avg value for a month (but not a period eg Jan-Aug 2019), and also brings out a constant value by post code ? (see below picture)
Many thanks for your help !
Solved! Go to Solution.
If you want to do date math you will want to add a calendar table to your data model.
Calc 2019 Avg = var yd = 2019-max('Calendar'[Year]) return CALCULATE(AVERAGE(Sheet1[value]),DATEADD('Calendar'[Date],yd,YEAR))
see attached.
which values do you think are incorrect? Remember that 2024 isn't complete yet.
Thanks Ibedlin ! That works for calculating the Avg in year by Category (in this case post code). But what about calculating the % change from 2019 Avg by Category ? In the attached this didn't pull back correct values ? using :
which values do you think are incorrect? Remember that 2024 isn't complete yet.
Thanks Ibendlin - solution works for comparing years to 2019 base year, but as you say will not work for part year 2024. Will need another solution to detected year to date 2024 data and compare to same year to date position for 2019, or full 2019 base year.
My solution works for YTD - that should be acceptable. No point in comparing partial 2024 to full 2019.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 14 | |
| 8 | |
| 8 | |
| 8 |