Forum Discussion

MP_123's avatar
MP_123
Microsoft Employee
10 years ago

sort by column

hi

is there any way to sort table\card\slicer by column that are not in the table?

i have a 'month' column in 1 for january,2,3,4... i cannot create new column by using format(month,mm) because of the direct query, and there is no way to format in the pbi to just month

i can create new column as : if month=1 then January.. etc, by the sorting will be alphabetic, and i want to sort by 1,2,3...

do you have a solution? thanks!<3

9 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Can you create a separate "Enter Data" query like:

     

    Month,Sort

    January,1

    February,2

    March,3

     

    Have "Month" sort by "Sort". Relate the two tables on "Month" and use the "Month" from this new table instead of from the other table?

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Can you use the "hidden column" trick. Basically, add both the month name and the month number as columns in the table and then shrink the month number column down so you can't see it and then use the visualization controls "..." to sort by the hidden column.

  • MP_123

    Hi,

    I'm afraid not, unless sorter key (month number this case) doesn't exist in original source. If it does, you could use sort by column option on modeling tab. Howerver as far as I know (and test), you can't sort persisted column by calculated column. So if you're connected using live connection to SQL Database and you have that option, it would be easiest to create view with sorter column and connect to it instead of table.

     

    Jiri