Data Sorting in Tableau

Data sorting is the process of arranging the given data in a systematic way based on your requirements.

The data present in the visualization and worksheet can be sort based on the requirement. It can sort the data based on data source order, ascending, descending, or depend on any measured value.

The following example demonstrates Data sorting:

  • Open Tableau and click on Connect to Data.
    connect-to-data-tableau
  • Then the Connect page will open, click on Microsoft Excel.
    click-on-connect-to-data-excel-file-tableau
  • Navigate to the downloaded files, select Sample Superstore.xls excel file, which is a saved excel file, and click on Open.
    connect-sample-superstore-to-tableau
  • You can download a Sample Superstore.xls file from the link: https://chercher.tech/files/
  • Once the data source has been connected, open a new worksheet by clicking on sheet1.
    naviagte-to-sheet1-tableau
  • The Sample Superstore excel file contains the below details.
    sample-superstore-excel-file-tableau
  • Here, I am connecting the Sample Superstore excel file to demonstrate this example.
  • Drag Orders sheet to workspace window.
    drag-orders-sheet-to-workspace-tableau
  • Next, click on Sheet1, it will navigate you to the sheet1 in the Tableau.
    click-and-navigate-to-sheet1-tableau
  • Now, drag Sales measure into the columns and Sub-category to the rows, you will see the bar graph as shown below.
  • Click on verticle lines in the Sub-Category, you will get the sorting options.
    get-sorting-options-tableau
  • Select the Sort option from the dropdown.
    select-sort-option-tableau
  • Once you click on the Sort option, you will navigate to the Sort window as shown below, in this window you can select either ascending or descending and then select the field name.
    • Ascending : It sorts the order of selected dimensions in ascending order.
    • Descending : It sorts the order of selected dimensions in descending order.
  • Click the Sort By dropdown, then you will get the below options in the drop-down.
    sort-by-oprtions-tableau

Tableau Data Relationship

Sort by options In Tableau

Data source Order : This option will sort the data in the order as given in the data source. We can also have two ways to sort the data source either in ascending or descending order.

  • Ascending means increasing order.
  • Descending means, in decreasing order.
  • Alphabet order : This option sort the data in alphabetical order. If we select Ascending then the data will be sorted in an A-Z manner.
  • Field : It sorts the field based on other dimensions or measure values.
  • Manual : The user can manually sort the data using this option.
  • Nested : Lets you select the field whose value will be used to determine the sort order. The field does not need to be used in the visualization.
  • Drag the Dimension variable Sub_Category to the row shelf and Measure variable Sales to the column shelf.
  • Next, right-click on the Sub_Category and select the Sort option from the list.
  • I have selected Alphabet with Ascending order, now, you can see that the elements in the bar graph have been arranged in ascending order.

sub-category-in-ascending-order-tableau

  • If you select the Alphabetic with Descending, then you will get the graph.
    descending-order-with-alphabetic-tableau1
  • Here, I am going to select Sort by Field in Ascending order, Next, you have to select the field name from the dropdown, I have selected the Order date as below.
    sort-by-fieldname-ascending-tableau
  • The graph will appear, which shows the sort by field names in ascending order depending on the Order date.
    graph-with-sort-by-field-name-ascending-order-tableu
  • In the same way, we can sort the data by selecting the sort order as Descending and by selecting the sort by options as Field, and field name as Sales as below.
    graph-with-sum-sales-in-desceing-oeder-tableau
  • Next, I am selecting the Sort by Manual, here we have to arrange the field names manually according to your preference.

manually-sorted-fields-tableau

  • Tableau provides four buttons to arrange your fields such as Move Top, Move Up, Move Down, and Move Bottom.
    • MoveTop : This option moves the selected field name to the Top in the given list(As the first filed name in the List).
    • Move UP : This option moves the selected field name to the one-step ahead.
      Ex: In the below image If you select the Supplies and click on Move UP, then the position of the Copiers will be replaced with Suppliers and vice versa.
    • Move Down : This option moves the selected field name to the one-step below.
      Ex: In the below image If you select the Supplies and click on Move down, then the position of the Fasteners will be replaced with Suppliers and vice versa.
    • Move Bottom : This option moves the selected field name to the Bottom in the given list(As the last field name in the List).
      move-up-top-bottom-down-botton-tableau
  • If you compare the field names in the graph and field names inside the manual sorting dropdown list, both are the same.

Tableau Worksheets

Replacing Data Source in Tableau

  • You can connect Tableau to multiple data sources in a single workbook.
  • Different data sources can be used to build various Sheets and Dashboards in Tableau.
  • In some cases, data sources are needed to be replaced with updated files.
  • The data source is having a replacing option, which can be used to replace the data source.
  • The replacing feature doesn’t affect the current visualizations which are built using old data source.
  • It is important to keep or replace all the used dimensions and measures values while replacing the data source.
  • Tableau divides the data into two main types: Dimensions and Measures.
  • Dimensions are usually those fields that cannot be aggregated; measures, as its name suggests, are those fields that can be measured, aggregated, or used for mathematical operations.
  • Dimension fields are usually used for row or column headings; measures are usually used for plotting or giving values to the sizes of markers.
  • The data source connected in Tableau can be replaced with another data source.

The procedure for replacing the data source

  • Open Tableau and click on Connect to Data.
    connect-to-data-tableau
  • Then the Connect page will open, click on Microsoft Excel.
    click-on-connect-to-data-excel-file-tableau
  • Open the Tableau and then connect an Excel file(P1-OfficeSupplies) to it.
    connect-an-xlsx-file-tableau
  • Once you click on sheet1, it will navigate you to sheet1.
    click-on-sheet-tableau
  • Drag columns(Item) and rows(Unit Price) from the Table and Measures.
    drag-columns-and-rows-tableau
  • Click on the Data in the upper left corner of the Tableau workspace and select New Data Source as below.
    select-new-data-source-tableau
  • Click on the Text file and select any(P1-OfficSupplies)text file present in your project folder and connect to Tableau.
    add-text-file-tableau
  • Next click on sheet1, It will navigate to the workspace where two data sources are connected.
    two-data-sources-are-connected-tableau
  • Right-click on any of the files which you wanted to replace and select the Replace Data Source option.
    replace-data-source-tableau
  • Next, the replace data source dialog box will open, you can select the replacement file from the drop-down and click on Ok.

replaced-file-tableau

The current file will be replaced by the new file.

0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions