Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Logins R6M =
VAR _noMonths = 6
VAR _lastSelectedDate = MAX('Date'[Date])
VAR _period =
DATESINPERIOD( 'Date'[Date], _lastSelectedDate, -_noMonths, MONTH)
VAR _result =
CALCULATE(
AVERAGEX(
VALUES('Date'[Fiscal Month Number]),
[Logins (sum)]
),
_period
)
VAR _lastDateWithLogin = MAX( 'Monthly User Activity by Project'[Date])
VAR _firstVisibleDate = MIN('Date'[Date])
RETURN
IF( _firstVisibleDate <= _lastDateWithLogin, _result)
Logins R6M (filter) =
VAR _noMonths = 6
VAR _lastSelectedDate = MAX('Date'[Date])
VAR _period =
CALCULATETABLE(
DATESINPERIOD(
'Date'[Date],
_lastSelectedDate,
-_noMonths,
MONTH
),
ALL('Date'[Date])
)
VAR _result =
CALCULATE(
AVERAGEX(
VALUES('Date'[Fiscal Month Number]),
[Logins (sum)]
),
_period
)
VAR _lastDateWithLogin = MAX( 'Monthly User Activity by Project'[Date])
VAR _firstVisibleDate = MIN('Date'[Date])
RETURN
IF( _firstVisibleDate <= _lastDateWithLogin, _result)
If my logic is correct, that is I do need to extend the period outside the scope of the Page Slicer, then why do both measures return the exact same values for the first dates shown. There should be at least some deviation between the two measures for the first 'period', eventually coming into alignment the further away you get from the 'start'.
Hi @rpiboy_1,
Yes, DATESINPERIOD respects the slicer context, so it won't include dates outside the slicer range, which might cause inaccuracies. Your version with CALCULATETABLE and ALL('Date'[Date]) is better because it ensures all needed dates are considered for accurate rolling averages.
Did I answer your question? If so, please mark my post as the solution!✔️
Your Kudos are much appreciated! Proud to be a Responsive Resident!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 11 | |
| 6 | |
| 5 |