Forum Discussion

fakeeh's avatar
fakeeh
New Member
2 years ago
Solved

Sorting Axis for Vizusalisations

Hi Need Help on this , i have a dataset like below that is  one customer query and customer rated like Average, Good, Poor, Excellent


so u sing these questions i created viz for each query like below

i didn't created measure , rather i used same column to take count 

now
i wanted to sort the x axis  in this order Excellent, Good, Average, Poor
for achiving this order, i tried to create another table with index column but that is not working becasue my data structure is different
plesae suggest ideas to achive this task,

regards
Data nerd

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, fakeeh 

    As you mentioned, I've created a simple sample:

    The default sorting is as follows:

    Here's how to reorder the rating column by another column:

    First, I created a calculated column using the following DAX expression, with the values representing the order in the x-axis.

    Sort column = SWITCH('Table'[Rating],
        "Excellent",1,
        "Poor",3,
        "Good",2)

    To avoid circular dependency issues, I copied the Ratin column and named it Rating column:

    Then use the Sort column to sort the Rating column column, as shown in the following figure:

    Use the Rating column column as the x-axis in the column chart visual:

    At this point, the ordering of the x-axis has changed. When I change the numbers in the Sort column, the order of the x-axis changes dynamically:

    I provide the PBIX file used this time below.

     

     

     

     

    How to Get Your Question Answered Quickly

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, fakeeh 

    As you mentioned, I've created a simple sample:

    The default sorting is as follows:

    Here's how to reorder the rating column by another column:

    First, I created a calculated column using the following DAX expression, with the values representing the order in the x-axis.

    Sort column = SWITCH('Table'[Rating],
        "Excellent",1,
        "Poor",3,
        "Good",2)

    To avoid circular dependency issues, I copied the Ratin column and named it Rating column:

    Then use the Sort column to sort the Rating column column, as shown in the following figure:

    Use the Rating column column as the x-axis in the column chart visual:

    At this point, the ordering of the x-axis has changed. When I change the numbers in the Sort column, the order of the x-axis changes dynamically:

    I provide the PBIX file used this time below.

     

     

     

     

    How to Get Your Question Answered Quickly

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.