This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
AverageEx fails when a datapoint does not exist. It's being short circuted.
We are trying to get an average calculation of days for a rolling 180 day period but we are finding that if we have a month that has not information Power BI is short circuting the calculation and I cannot just try to figure out how to solve this.
For example the data:
Item 1: August 2024 - Days 12
Item 2: August 2024 - Days 5
Item 3: August 2024 - Days 9
Item 4: Sept 2024 - Days 47
Item 5: Sept 2024 - Days 8
Item 6: Oct 2024 - Days 12
Item 7: Dec 2024 - Days 4
Item 8: Jan 2025 - Days 86
Item 9: Jan 2025 - Days 13
Rolling Days by Month are as follows:
August = 8.67 (which I expect)
Sept = 16.20 (which I epxect)
Oct = 15.50 (which I expect)
Nov = 0 (which is wrong - because there are no 'Items' in November this is getting short circuted.
Dec = 13.86 (which I expect)
Measure we are using:
Solved! Go to Solution.
Hi,
Try this so that your measure uses Calendar dates for anchors and iterator comes from the Calendar table.
Rolling Average Time to Close =
VAR _maxDate = MAX('Relations Calendar'[Date])
VAR _minDate = _maxDate - 180
RETURN
CALCULATE (
AVERAGEX (
FILTER (
ALL ( 'Items' ),
'Items'[Closed Date] >= _minDate &&
'Items'[Closed Date] <= _maxDate
),
'Items'[Actual Start To Close]
),
USERELATIONSHIP ( 'Relations Calendar'[Date], 'Items'[Closed Date] )
)
Hi,
Try this so that your measure uses Calendar dates for anchors and iterator comes from the Calendar table.
Rolling Average Time to Close =
VAR _maxDate = MAX('Relations Calendar'[Date])
VAR _minDate = _maxDate - 180
RETURN
CALCULATE (
AVERAGEX (
FILTER (
ALL ( 'Items' ),
'Items'[Closed Date] >= _minDate &&
'Items'[Closed Date] <= _maxDate
),
'Items'[Actual Start To Close]
),
USERELATIONSHIP ( 'Relations Calendar'[Date], 'Items'[Closed Date] )
)
I think I need to change the ALL to ALLSELECTED like I had in my original post. I am checking it but I think it might be working!
Yes, if you want to preserve page/visual slicer selections. This way you keep the external selection context.
That returns too high of values because I believe _maxDate is being set wrong.
The values I am getting now are as follows:
August = 40.07 (this is wrong)
Sept = 42.29 (this is wrong)
Oct = 45.41 (this is wrong)
Nov = 43.13 (this is wrong - but I am getting a number)
Dec = 44.50 (this is wrong)
Deleted
I'm guessing this 'Relations Calendar' table would be user's date/calendar table. 🙂 but maybe I'm wrong.
Yeah, you are right 🙂 Have some Kudos.
Deleted
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 23 | |
| 22 | |
| 16 | |
| 15 |
| User | Count |
|---|---|
| 61 | |
| 35 | |
| 28 | |
| 22 | |
| 21 |