Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi, below DAX does not display correct result. What this code should be doing is displaying "RPMD" for previous 10 periods. Each period is a week. I suspect the problem lands possibly caused by misusing of CALCULATE, FILTER and ALL. Please advise.
RPMD Last 10 =
VAR _selecteddate =
MIN ( 'Calendar'[Date] )
RETURN
CALCULATE (
[RPMD],
FILTER (
ALL ( 'Calendar'[Date] ),
IF (
'Calendar'[Date] = _selecteddate - 7,
'Calendar'[Date],
IF (
'Calendar'[Date] = _selecteddate - 14,
'Calendar'[Date],
IF (
'Calendar'[Date] = _selecteddate - 21,
'Calendar'[Date],
IF (
'Calendar'[Date] = _selecteddate - 28,
'Calendar'[Date],
IF (
'Calendar'[Date] = _selecteddate - 35,
'Calendar'[Date],
IF (
'Calendar'[Date] = _selecteddate - 42,
'Calendar'[Date],
IF (
'Calendar'[Date] = _selecteddate - 49,
'Calendar'[Date],
IF (
'Calendar'[Date] = _selecteddate - 56,
'Calendar'[Date],
IF (
'Calendar'[Date] = _selecteddate - 63,
'Calendar'[Date],
IF ( 'Calendar'[Date] = _selecteddate, 'Calendar'[Date], BLANK () )
)
)
)
)
)
)
)
)
)
)
)
Solved! Go to Solution.
@anubb688 Probably, Why not just get the current date and if you want the past 10 periods (each a week) then something like:
RPMD Last 10 =
VAR __SelectedDate = MIN('Calendar'[Date])
VAR __10Prior = __SelectedDate - 70
RETURN
CALCULATE([RPMD],FILTER('Calendar','Calendar'[Date]>=__10Prior && 'Calendar'[Date]<=__SelectedDate))
@anubb688 Probably, Why not just get the current date and if you want the past 10 periods (each a week) then something like:
RPMD Last 10 =
VAR __SelectedDate = MIN('Calendar'[Date])
VAR __10Prior = __SelectedDate - 70
RETURN
CALCULATE([RPMD],FILTER('Calendar','Calendar'[Date]>=__10Prior && 'Calendar'[Date]<=__SelectedDate))
It somehow shows a dot instead of line chart which i have selected
Maybe:
RPMD Last 10 =
VAR __SelectedDate = MIN('Calendar'[Date])
VAR __10Prior = __SelectedDate - 70
RETURN
CALCULATE([RPMD],FILTER(ALL('Calendar'),'Calendar'[Date]>=__10Prior && 'Calendar'[Date]<=__SelectedDate))
It's really hard to know with such incomplete information.
Your code worked when I tweaked my beneath formulas. Thanks. I'll mark yours as solution since I found my direction.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
8 | |
4 | |
3 |
User | Count |
---|---|
15 | |
15 | |
11 | |
10 | |
10 |