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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I'm trying to create a measure to find the ranking of the previous year from the year selected by one of my slicers. Would be great if this was dynamic as the data is going to be a rolling five years however if i can't that's not a huge issue. I have this currently but I don't think it is getting the distinct rank and is adding up the ranks for the specific think over all the years.
Solved! Go to Solution.
From the look of your code, your TIMERANGE is not a date column. Change it to whole number then try:
Last Year Rank = var _SelectedYear = selectedvalue(scorecard[TIMEFRAME_RANGE]) RETURN CALCULATE( SUM(scorecard[RANKING]), scorecard[TIMEFRAME_RANGE] = _SelectedYear -1 )
Appreciate your Kudos
Connect with me!
Stay up to date on
Read my blogs on
Did I answer your question? Mark my post as a solution! Proud to be a Super User!
Connect with me!
Stay up to date on
Read my blogs on
Have you tried sampleperiodlastyear https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
I tried this but it doesn't work (function previousyear has been used in a true/false expression that is used as a table filter expression. this is not allowed.)
From the look of your code, your TIMERANGE is not a date column. Change it to whole number then try:
Last Year Rank = var _SelectedYear = selectedvalue(scorecard[TIMEFRAME_RANGE]) RETURN CALCULATE( SUM(scorecard[RANKING]), scorecard[TIMEFRAME_RANGE] = _SelectedYear -1 )
Appreciate your Kudos
Connect with me!
Stay up to date on
Read my blogs on
Did I answer your question? Mark my post as a solution! Proud to be a Super User!
Connect with me!
Stay up to date on
Read my blogs on
Thanks Steve, looks like I just need to correct the format as the timeframe_range column is text, not numeric.
Last Year Rank = var _SelectedYear = selectedvalue(scorecard[TIMEFRAME_RANGE]) RETURN CALCULATE( SUM(scorecard[RANKING]), scorecard[TIMEFRAME_RANGE] = _SelectedYear -1 )
Appreciate your Kudos
Connect with me!
Stay up to date on
Read my blogs on
Did I answer your question? Mark my post as a solution! Proud to be a Super User!
Connect with me!
Stay up to date on
Read my blogs on
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 103 | |
| 79 | |
| 57 | |
| 51 | |
| 46 |