Forum Discussion

ElvirBotic's avatar
ElvirBotic
Helper III
5 years ago
Solved

Need Advice on Sorting.

Hello, all,    Looking for some good advice on creating a sort column in Power BI. I have seen people use excel to create sorts and import, then merge with their existing table and I do not like th...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi ElvirBotic 

    Currently you have a fact table "Inspections" and dimension for "templates". If you want to sort templates by specific order, I think add a sort table or sort column is a good way. 

    I build a sample to have a test.

    Fact Table:

    Dimension Table:

    Here I will give some advice.

    1. If your number of data in "templates" is not large, you can build a sort column(calculated column) by switch function.

    Calcualte column Sort = SWITCH(templates[templates],"A",2,"B",1,"C",3,"D",5,"E",4)

    I think you have related fact table and dimension table by "templates" column. If you want to get sort in fact table try related function.

    Relate sort from dimension = RELATED(templates[Calcualte column Sort])

    Sort template column by sort column in column tool.

    2. Your template column has lots of data, get a sort table is a better way.

    Use excel(or other data source) to create a sort table and import.

    You meet privacy error when you merge the new table with existing table. I think you need to edit the Privacy of two tables to the same in Data source setting. Then you can do merge.

    Or you don't need to merge you can relate sort table with dimension table.

    Sort templates in sort table by sort column as above.

    Then you can use templates in Sort column to build your visuals and your can sort templates by sepcific sort.

    If you want to add sort into other tables use related function to build sort column as above.

     

    Best Regards,

    Rico Zhou

     

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