Forum Discussion

danielsouza's avatar
danielsouza
Icon for Helper III rankHelper III
8 years ago
Solved

How to keep the same line order in table report?

I have this data model, with column DESCRIÇÃO ordered this way:       And I need to keep the same order in this table report:         Thanks a lot Daniel
  • Hardik's avatar
    8 years ago

    you can sort the column  on both the data model and the report .Hope this helps danielsouza

  • danextian's avatar
    8 years ago

    Hi danielsouza,

     

     

    For the following steps, I am assuming that row order from your source file is the same as on  your screenshot  and the values in DESCRIÇÃO are unique - no duplicates. 

    • In the query editor, duplicate your original query. Right click on the query name from the query pane (left side) and then click Duplicate.
    • Select DESCRIÇÃO column, right click and then Remove Other Columns.
    • Filter the remaining column. Select Remove Empty. 
    • From Add Column tab, click Index Column. It doesn't matter whether your index starts from 0 or 1. 
    • Load the duplicate table to your model.
    • In the relationship view, drag DESCRIÇÃO  from the duplicate to the DESCRIÇÃO in the original table.
    • Once a relationship between the two is established, create a calculated colum in the original table. You can name it DESCRIÇÃO  sort order or anyway you want. The formula would be RELATED('Name of Duplicate Table'[Index]).  This calculated column will be used to custom sort DESCRIÇÃO.
    • Select the original DESCRIÇÃO column. From the Modeling tab in Power BI designer, click Sort by Column and select the calculated column in the prevoius step.
    • Put DESCRIÇÃO  in a table or matrix to check whether the custom sort order works.

     

    Remove