Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ronnoc
Advocate II
Advocate II

Sort axis values by spend of most recent year (2016)

I can sort the axis by year or by spend, is it possible to have them sort by the largest spend for the year 2016? (so Pharmaton first)

 

DAX formula possibly?

 

Any insight appreciated! 

 

spend by top 10.PNG

1 ACCEPTED SOLUTION

Hi @ronnoc,

 

Perhaps you can use "Line and clustered column chart" to sort by rank measure.

 

Capture.PNG

 

In addition, I test on clustered column chart but haven't found a way to sort by other fields.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
austinsense
Impactful Individual
Impactful Individual

Yes, it's possible, not as easy as it should be. There are probably other ways to do this, but here's one approach to have them sort by "2016 Spend":

 

1. Create a "2016 Spend" measure

 

2016Spend:= CALCULATE([Spend], Calendar[Year] = 2016)

 

 

2. Create a "Brand Rank by 2016 Spend" measure

 

BrandRankby2016Spend:= RANKX( ALL(Brands[BrandName]), [2016Spend])

 

3. I'm actually not sure how to do the "Sort By" in Power BI but you can give it a whirl - you may have to create #2 as a Calculated Column

 

 

Here's where we cover RANKX: https://www.powerpivotpro.com/2015/06/rankx-apalooza-within-and-across-groups-with-filters-etc/

Austin is VP Operations at PowerPivotPro and a professional self-service enthusiast 🙂

Have you tested the measure BrandRankby2016Spend? 

 

Could be something wrong with my dataset but it just returns 1 on every row.

 

Thanks for your help so far.

 

1111.PNG

@austinsense Thanks for your help! Unfortunately I cant order Brand by the new calculared column brandRankBy2016 because a column can not be sorted by another column that is already sorted by the first column hahaha.

 

PowerBI: the difficult stuff became easy, the easy stuff became impossible

Hi @ronnoc,

 

Perhaps you can use "Line and clustered column chart" to sort by rank measure.

 

Capture.PNG

 

In addition, I test on clustered column chart but haven't found a way to sort by other fields.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.