Custom Sorting a Slicer

zakkair

New Member
Joined
Jan 29, 2013
Messages
39
Hi I have a file that basically records everyday data that comes in

Column A has suppliers like "Suncor", "Shell", "IOL" (they repeat sometimes), Column B is the product such as "GAS", "DIESEL", "GAS10", "AVGAS".... then column C has volumes.

Sample would be like
Suncor, DIESEL, 10000
Suncor, GAS, 5000
Suncor, AVGAS 10000
IOL, GAS, 2000
IOL, GAS, 5000
...

When I created a powerpivot with chart and created slicers, they are ordered alphabetically. I want it such that it is ordered in a custom way. Is this possible?


Thanks in advance for the help!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
In PowerPivot v2 and beyond, there is a "sort by column" feature that you can use for precisely this.

It's on the first tab of the ribbon in the PowerPivot window. You add a numeric column that is numbered appropriately and then sort the label column by that numeric column.

This is also briefly illustrated near the end of this post:

http://www.powerpivotpro.com/2011/07/powerpivot-v2-ctp3/
 
Last edited:
Upvote 0
I keep getting this circular dependency error when I sort by column and create unique numbers using nested ifs. Do you know why?
 
Upvote 0
If those nested IF's depend on the column you are trying to sort, I think that triggers a circular error.

One trick I have found useful is to create a two-column table in normal Excel - Label and SortOrder - and number the sort order column manually or with any formulas you want.

Then copy/paste or link that table over into PowerPivot, relate it to your existing table using the Label column (make your new table the Lookup table in the relationship BTW), then use =RELATED() to fetch the SortOrder column from your new table into the existing table. Then use that new column as your SortOrder column.
 
Upvote 0
Thank you sooo much Rob! It worked perfectly. Easier too since I can number it myself! :)

And great book btw, a great interesting introduction to PowerPivot with enough indepth information to make a lot of my files more efficient :D
 
Upvote 0
I'm running into another problem on the sort. The procedure worked for about 5 of my fields until I tried to sort it by "Supplier". I followed the exact procedures before but now I get the error "Index is out of range..." and a really long error message shaped somewhat like this. It's fine if there's no fix, but I'm just wondering if it is too much data set.

************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Windows.Forms.DataGridViewColumnCollection.get_Item(Int32 index)
at Microsoft.AnalysisServices.Common.TableWidgetGridControl.widgettag_ItemsChanged(Object sender, WidgetTagEventArgs e)
at Microsoft.AnalysisServices.Common.TableWidgetTag.OnItemsChanged(TagColumn tagColumn)
at Microsoft.AnalysisServices.Common.TableWidgetTag.Add(IWidgetTagItem tagItem)
at Microsoft.AnalysisServices.Common.TableWidgetGridControl.UpdateWidgetTags()
at Microsoft.AnalysisServices.Common.TableWidgetHeaderCell.set_ColumnFilter(ColumnFilter value)
at Microsoft.AnalysisServices.Common.TableWidgetGridControl.LoadColumnFilters(TableWidgetGridColumn column)
at Microsoft.AnalysisServices.Common.TableWidgetGridControl.LoadColumnProperties(String columnName)
at Microsoft.AnalysisServices.Common.TableWidgetGridControl.InitializeGridLayout(Boolean isReset)
at Microsoft.AnalysisServices.Common.TableWidgetGridControl.SetStorageTable(ITableDataView value, Stream stream)
at Microsoft.AnalysisServices.Common.TableWidgetPanel.SetStorageTable(ITableDataView value, Stream stream)
at Microsoft.AnalysisServices.Common.SandboxEditor.InitializeTableWidget(DataModelingTable table)
at Microsoft.AnalysisServices.Common.SandboxEditor.PopulateTableWidget(String tableId)
at Microsoft.AnalysisServices.Common.SandboxEditor.sheetsTab_sheetChanged(Object sender, EventArgs e)
at Microsoft.AnalysisServices.Common.SheetTabs.SetSelectedSheetInternal(String key)
at Microsoft.AnalysisServices.Common.SheetTabs.button_Click(Object sender, EventArgs e)
at Microsoft.AnalysisServices.Common.SheetTabs.Button_MouseDown(Object sender, MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseMouseEvent(Object key, MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseDown(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseDown(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
....
 
Upvote 0

Forum statistics

Threads
1,223,937
Messages
6,175,511
Members
452,650
Latest member
Tinfish

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top