Forum Discussion

jjr333's avatar
jjr333
Advocate I
7 years ago
Solved

Sort alphanumeric column by an numeric column

Hi,

I have a datatable with air pollution readings.

"Wind Dir" is derived from the column "Dirección" (which contains the direction in degrees) by using a "bucket table" / lookup table.

Wind Dir = IF (ISBLANK(factSanSeb[Dirección]);BLANK();
                CALCULATE(  
                            VALUES(WindDirection[Direction]); 
                            FILTER(WindDirection; factSanSeb[Dirección] >= WindDirection[Low] && factSanSeb[Dirección] < WindDirection[Hi])
                        ) )


I have added "WindDirOrder" column (N = 1, NE = 2, E = 3, etc using an unrelated lookup table) to be able to sort column "Wind Dir", which does not seem to work in the bar charts and radar chart.

 

Any suggestions? Cheers, Julian

 

 

  • jjr333's avatar
    jjr333
    7 years ago

    Hi Anonymous ,

    Finally got it to work.

    My problem was the added Calculated column X (with the sort order) depended on another Calculated column Y which I wanted to sort by X.

    Cheers, Julian

6 Replies

    • jjr333's avatar
      jjr333
      Advocate I

      Guten Abend Tom,

      I keep getting a message "Sorting on a different column: This column cannot be sorted by a column which has already (direct or indirect) been sorted by this column."

      My sort by column is a calculated column. Not sure if this is important.

      Cheers, Julian

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI jjr333 ,

        You can create a calculate table to achieve this, please refer to following blog to know more about this:

        Custom Sorting in Power BI

        Please understand that this link is provided with no warranties or guarantees of content changes, and confers no rights.

        Regards,

        Xiaoxin Sheng