Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Bar Chart Sort w/Groups

Hello everyone -    Tried searching and attempted a few resolutions but was unable to solve this. Would appreciate your help.    I have a data set as follows:    Column title: Tenure  Data Ins...
  • jdbuchanan71's avatar
    7 years ago

    Hello Anonymous 

    What you need is a numeric column in your data that tells PowerBI how to sort your Tenure column.  In my example I added a column to the table based on the Tenure Months.

    TenureSort = 
    SWITCH (
        TRUE (),
        Employees[Tenure Months] < 13, 1,
        Employees[Tenure Months] < 61, 2,
        Employees[Tenure Months] < 121, 3,
        Employees[Tenure Months] < 181, 4,
        5
    )

    Use the same logic for this column that you used for the Tenure column, just return the number instead.

    Then, in the table, select the Tenure column and set the "Sort by Column" to be TenureSort.  

     

    That sorting gets applied to the Tenure column in the visual.