Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello, I would like to have this measure:
Spain should be before Poland.
Solved! Go to Solution.
Hi @Ania26 ,
You can use the 2025 year value to sort the bar chart in the descending order by creating a sorting measure like below and putting in the tooltip field.
Rank by Latest Year =
VAR CurrentCountry = SELECTEDVALUE('X'[Country]) // <-- Replace with your country column
VAR RecentYearValue = calculate([Total Amount],'Calendar'[Year]=2025) // <-- Replace with your 2025 value measure
RETURN
IF(
CurrentCountry = "Other",
-999999999, // A very large negative number to push "Other" to the last position
RecentYearValue
)
Then you can click on the three dot elipsis .... and select the measure above.
The resultant out put is as shown above which is in line with your requirement.
I am attaching an example pbix file for your reference.
Best regards,
Hi @Ania26 ,
You can use the 2025 year value to sort the bar chart in the descending order by creating a sorting measure like below and putting in the tooltip field.
Rank by Latest Year =
VAR CurrentCountry = SELECTEDVALUE('X'[Country]) // <-- Replace with your country column
VAR RecentYearValue = calculate([Total Amount],'Calendar'[Year]=2025) // <-- Replace with your 2025 value measure
RETURN
IF(
CurrentCountry = "Other",
-999999999, // A very large negative number to push "Other" to the last position
RecentYearValue
)
Then you can click on the three dot elipsis .... and select the measure above.
The resultant out put is as shown above which is in line with your requirement.
I am attaching an example pbix file for your reference.
Best regards,
Here’s a simple sort-key measure that ranks by the latest selected year and always pushes “Other” to the end:
Sort (RecentYear, Other last) :=
VAR RecentYear =
MAXX ( ALLSELECTED ( 'Date'[Year] ), 'Date'[Year] )
VAR ValRecentYear :=
CALCULATE ( [Total Total C], KEEPFILTERS ( 'Date'[Year] = RecentYear ) )
VAR IsOther = SELECTEDVALUE ( 'X'[Country] ) = "Other"
VAR RankRecent :=
RANKX (
ALLSELECTED ( 'X'[Country] ),
CALCULATE ( [Total Total C], KEEPFILTERS ( 'Date'[Year] = RecentYear ) ),
, DESC, DENSE
)
RETURN IF ( IsOther, 100000 + RankRecent, RankRecent )
Use this measure to Sort by in the visual (ellipsis › Sort by › Sort (RecentYear, Other last)).
If you also apply a Top-N, use the same RANKX expression but replace ALLSELECTED('X'[Country]) with your Top-N table.
Hello @Ania26 , It sorts based on total. Please mention Year level filtering in your TOPN and that will help you to bring Spain above Poland.
Mark this comment as answer if it helps you so that others can reach quickly. Thanks.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.