Custom Sorting in Power BI

Power BI desktop allows users to sort various visuals (Table Visual, Matrix, Charts etc) by Row Fields, Value fields, MEASURES, Axis etc in Ascending or Descending Order.

But often we need our own customized sort order that is neither based on alphabets or values.

Consider an Income Statement of a listed company on New York Stock Exchange. Items are presented in a logical manner which is prescribed by International Accounting Standards

If you present this in Power BI…for example sorting using ITEMS column…you will get

Index Column is very handy in such situations to create a custom sort order.

First create a  New Table with all the Income Statement Items


Then Add an Index Column to it from the Query Editor

Now Exit the Query Editor>>>Go to DATA view >>>Select the ITEMS column in the New Table>>Go to Modelling Tab>>Sort by Column>>Select Index

Now whenever you use the ITEMS from above table…they will be sorted according to their respective Index numbers

The Final step is to link your Main “Data” Table with the above supporting Table we created for custom sorting

Now we can get the correct sort order just by using the Column “Items” from Sorted Table “IS_items”.

Click here to download the pbix File and play with it

MULTIPLE SPARKLINES

This is my new Custom Visual “Multiple Sparklines“. Please check it out and let me have your feedback and suggestions