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.
I am working in Tabular Editor 3, and trying to create a measure in DAX which will allow me to show data in a calculation group where according to the Year selected in a filter the table will show data for that year and the previous year, dynamically changing as the filter selection changes. I have a working measure for the current year, but am unable to work out why it doesn't work when I try to use "Year - 1" within the calculation.
I have a measure which works to identify the Year selected in the filter:
YearOfEntrySelected = SELECTEDVALUE(LookupEntryYear[YearOfEntry])
The measure I am using works as long as I don't use - 1:
VAR YearSelected = [YearOfEntrySelected]
RETURN
IF(
SELECTEDVALUE( DataCourseApplications[LatestYearOfEntry] ) = YearSelected,
CALCULATE(
COUNTROWS( DataCourseApplications )
, DataCourseApplications[LatestRecord] <> BLANK()
)
)
But does not work when I add the - 1 to the variable (or directly to the Measure and reference that in the IF statement):
VAR YearSelected = [YearOfEntrySelected] - 1
RETURN
IF(
SELECTEDVALUE( DataCourseApplications[LatestYearOfEntry] ) = YearSelected,
CALCULATE(
COUNTROWS( DataCourseApplications )
, DataCourseApplications[LatestRecord] <> BLANK()
)
)
The Year values all look to be formatted as Whole Numbers, so I don't believe that there should be any issue with the minus 1 and it matching to the LatestYearOfEntry.
Any thoughts and ideas welcome - I've asked a number of colleagues and we are all perplexed!
Solved! Go to Solution.
Hi @Anonymous ,
Please have a try.
To avoid this problem, you can use the MAX or MIN function instead of SELECTEDVALUE, which will return the maximum or minimum value in the filter context. For example, you can use this formula:
VAR YearSelected = MAX(LookupEntryYear[YearOfEntry]) - 1
RETURN
IF(
MAX(DataCourseApplications[LatestYearOfEntry]) = YearSelected,
CALCULATE(
COUNTROWS(DataCourseApplications),
DataCourseApplications[LatestRecord] <> BLANK()
)
)
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please have a try.
To avoid this problem, you can use the MAX or MIN function instead of SELECTEDVALUE, which will return the maximum or minimum value in the filter context. For example, you can use this formula:
VAR YearSelected = MAX(LookupEntryYear[YearOfEntry]) - 1
RETURN
IF(
MAX(DataCourseApplications[LatestYearOfEntry]) = YearSelected,
CALCULATE(
COUNTROWS(DataCourseApplications),
DataCourseApplications[LatestRecord] <> BLANK()
)
)
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
What's the relevance of calculation groups here? Isn't that something a regular measure can do?
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.