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
Hello,
In Dax, I have this measure:
_AVG 1Y Revenue v2 =
AVERAGEX (
DATESINPERIOD ( Date[Date], LASTDATE ( Date[Date] ), -1, YEAR ),
[Revenue]
) How can I filter Date[Date] so that the average is calculated based on the working days column Date[isWorkingDay] (0 for weekends, 1 for working days)? putting in mind that DATESINPERIOD doesn't accept virtual tables as its first parameter?
Best regards,
Simon
Solved! Go to Solution.
Try
_AVG 1Y Revenue v2 =
VAR MaxDate =
MAX ( 'Date'[Date] )
VAR LastYear =
DATE ( YEAR ( MaxDate ) - 1, MONTH ( MaxDate ), DAY ( MaxDate ) )
VAR DatesToUse =
CALCULATETABLE (
VALUES ( 'Date'[Date] ),
'Date'[Date] >= LastYear
&& 'Date'[Date] < MaxDate
&& 'Date'[Is Working Day] = 1
)
RETURN
AVERAGEX ( DatesToUse, [Revenue] )
Try
_AVG 1Y Revenue v2 =
VAR MaxDate =
MAX ( 'Date'[Date] )
VAR LastYear =
DATE ( YEAR ( MaxDate ) - 1, MONTH ( MaxDate ), DAY ( MaxDate ) )
VAR DatesToUse =
CALCULATETABLE (
VALUES ( 'Date'[Date] ),
'Date'[Date] >= LastYear
&& 'Date'[Date] < MaxDate
&& 'Date'[Is Working Day] = 1
)
RETURN
AVERAGEX ( DatesToUse, [Revenue] )
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 |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 17 | |
| 9 | |
| 7 | |
| 6 |