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 ... I have below measure to get last 3 year data.
Last 3 Year =
VAR _currentyear = YEAR(TODAY())
VAR _previousyear = SELECTEDVALUE('Date Table'[Date].[Year])
RETURN
SWITCH(
TRUE(),
_previousyear <= _currentyear -1 &&
_previousyear >= _currentyear -3, 1,
0
)
I also need a new measure to get the most recent 12 quarter for another chart ... How can I achieve that ...
Tq in advanced.
Regards,
NickzNickz
plz try this measure:
Most Recent 12 Quarters =
VAR _currentQuarter = QUARTER(TODAY())
VAR _currentYear = YEAR(TODAY())
VAR _selectedQuarter = SELECTEDVALUE('Date Table'[Date].[Quarter])
VAR _selectedYear = SELECTEDVALUE('Date Table'[Date].[Year])
VAR _quartersAgo = (_currentYear - _selectedYear) * 4 + _currentQuarter - _selectedQuarter
RETURN
IF (
_quartersAgo >= 0 && _quartersAgo < 12,
1,
0
)
plz try this modified DAX:
Most Recent 12 Quarters =
VAR _currentQuarter = QUARTER(TODAY())
VAR _currentYear = YEAR(TODAY())
VAR _quartersToInclude = 12
VAR _selectedQuarter = SELECTEDVALUE('Date Table'[Date].[Quarter])
VAR _selectedYear = SELECTEDVALUE('Date Table'[Date].[Year])
RETURN
IF(
_selectedYear = _currentYear &&
_selectedQuarter >= _currentQuarter - _quartersToInclude,
1,
0
)
OR
I apologize for any confusion. Let's troubleshoot and refine the measure. Please ensure the following:
Check Date Table Relationships:
Check Column References:
Verify Data:
Here's the revised measure, including a fix for potential issues:
Most Recent 12 Quarters =
VAR _currentQuarter = QUARTER(TODAY())
VAR _currentYear = YEAR(TODAY())
VAR _quartersToInclude = 12
VAR _selectedQuarter = SELECTEDVALUE('Date Table'[Quarter]) -- Update with your actual column name
VAR _selectedYear = SELECTEDVALUE('Date Table'[Year]) -- Update with your actual column name
RETURN
IF(
NOT ISBLANK(_selectedQuarter) &&
NOT ISBLANK(_selectedYear) &&
_selectedYear = _currentYear &&
_selectedQuarter >= _currentQuarter - _quartersToInclude,
1,
0
)
Make sure to replace 'Date Table'[Quarter] and 'Date Table'[Year] with the actual column names from your Date Table. If the issue persists, there might be specific aspects of your data model or requirements that we need to consider.
Hi @123abc ,
I still got error... for info, my column has date, year and month... Date/Month for 3, 6, 9 and 12 + 13 final value after audited.
Can we use Top N function ? ...
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.