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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
tgreve4ts
Regular Visitor

Chart Sorting - Highest to Lowest

This is a 3-fold question ...

 

Using the test-data below as to which adults and kids like the various fruit (1 represents they like that fruit), my goal is to have a chart that shows which fruit is the most popular compared on down to which one is the least popular.

 

I can pull the data into a Power BI report, but am not finding how to do the sort from most popular to least popular.

 

1) My data comes from a website questionnaire and is downloaded into Excel similar to this.  My goal will be to keep uploading (or auto refreshing) the new data received so the charts will continously reflect the additional/new data received.

 

VersionFirst NameLast NameLocationOrangesApplesWatermelonPineappleBananasStrawberries
KidsFN1LN1Location111 1 1
AdultsFN2LN2Location21 1 1 
AdultsFN3LN3Location1 1   1
KidsFN4LN4Location2111111

 

This is what my data looks like thus far.

tgreve4ts_0-1595734868480.png

2nd Item: Need help getting the names of the fruit the bars in the chart represent underneath each bar rather than represented by a different color and noted in the Legend Name.  Note:  My real data has about 50 different options that will be sorted.

 

3rd Item: I'll also need to be able to filter by Version (Kid, Adult or both) and Location (Location1, Location 2, or both)

 

Thank you for your assistance!

2 ACCEPTED SOLUTIONS
AllisonKennedy
Super User
Super User

I think all three of these items can be solved if you UNPIVOT your fruits. https://radacad.com/pivot-and-unpivot-with-power-bi

Scroll down to the Unpivot section in that post.
Since you have over 50 options, I would recommend you select the demographic columns (Version, Location, etc) and then UNPIVOT OTHER COLUMNS. but up to you which is easier.

Once you have done the Unpivot in Power Query, it will be easy to put the 'Attribute' (which you will probably rename to 'Fruit' or something similar) in Axis and 'Value' in Values to get the chart you want.

You can also then easily sort by most popular fruit/attribute/item https://docs.microsoft.com/en-us/power-bi/consumer/end-user-change-sort

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

FrankAT
Community Champion
Community Champion

Hi @tgreve4ts ,

as @AllisonKennedy mentioned you must first unpivot your data (fruit columns) with Power Query. Then you can build very easy the report like this:

 

26-07-_2020_12-39-21.png

 Regards FrankAT

View solution in original post

4 REPLIES 4
FrankAT
Community Champion
Community Champion

Hi @tgreve4ts ,

as @AllisonKennedy mentioned you must first unpivot your data (fruit columns) with Power Query. Then you can build very easy the report like this:

 

26-07-_2020_12-39-21.png

 Regards FrankAT

@FrankAT    Thank you SO VERY MUCH!   Your directions were amazing and everything is working/sorting as I needed it to now.  Appreciate you taking the time to help me out!

AllisonKennedy
Super User
Super User

I think all three of these items can be solved if you UNPIVOT your fruits. https://radacad.com/pivot-and-unpivot-with-power-bi

Scroll down to the Unpivot section in that post.
Since you have over 50 options, I would recommend you select the demographic columns (Version, Location, etc) and then UNPIVOT OTHER COLUMNS. but up to you which is easier.

Once you have done the Unpivot in Power Query, it will be easy to put the 'Attribute' (which you will probably rename to 'Fruit' or something similar) in Axis and 'Value' in Values to get the chart you want.

You can also then easily sort by most popular fruit/attribute/item https://docs.microsoft.com/en-us/power-bi/consumer/end-user-change-sort

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy    Huge Virtual High-5!   Your assistance was so appreciated!   Everything is working/sorting as I needed it to now.   Thank you!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors