Reply
Regular Visitor
Posts: 28
Registered: ‎10-26-2016
Accepted Solution

Sorting Data Manually

Hi!

 

How do I sort a stacked bar chart by age group in ascending order? 

From Below 18 Years old to 65+ Years old?

Capture.PNG

 

Thanks!


Accepted Solutions
Highlighted
Super User
Posts: 2,146
Registered: ‎08-11-2015

Re: Sorting Data Manually

[ Edited ]

@miguelflores

I take it you've created those "Bins" with a conditional column

I'm calling this column Category in the image below

Then I use it to create another Column called Custom Sort which we'll use to sort the Bars

See image below - let me know if you have any questions...

Query Editor - Sort By Column.gif

Hope this helps! Smiley Happy

 

EDIT: I've used the Query Editor for both columns

but you can use SWITCH statements (nested IFs) to get the same results with DAX created columns! Smiley Happy

View solution in original post


All Replies
Super User
Posts: 2,146
Registered: ‎08-11-2015

Re: Sorting Data Manually

[ Edited ]

Click the ellipses ... in the top right corner of the Visual - Sort By

Regular Visitor
Posts: 28
Registered: ‎10-26-2016

Re: Sorting Data Manually

I already tried it but the result looks like this:


Capture.PNG

 

In my mind it shoutd be:

Below 18 Years Old

18-24 Years Old

25-34 Years Old

35-44 Years Old

45-54 Years Old

55-64 Years Old

65+ Years Old

 

is there a way to manually sort it?

 

Thanks!

Super User
Posts: 1,687
Registered: ‎05-10-2016

Re: Sorting Data Manually

@miguelflores

 

You need to do something like

this:

 

 




Lima - Peru
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




Highlighted
Super User
Posts: 2,146
Registered: ‎08-11-2015

Re: Sorting Data Manually

[ Edited ]

@miguelflores

I take it you've created those "Bins" with a conditional column

I'm calling this column Category in the image below

Then I use it to create another Column called Custom Sort which we'll use to sort the Bars

See image below - let me know if you have any questions...

Query Editor - Sort By Column.gif

Hope this helps! Smiley Happy

 

EDIT: I've used the Query Editor for both columns

but you can use SWITCH statements (nested IFs) to get the same results with DAX created columns! Smiley Happy

Regular Visitor
Posts: 28
Registered: ‎10-26-2016

Re: Sorting Data Manually

Thanks!

Regular Visitor
Posts: 28
Registered: ‎10-26-2016

Re: Sorting Data Manually

Thanks! I got it! Smiley Happy

 

What books do you recommend in using the powerbi more effectively and efficiently?