Forum Discussion

admin11's avatar
admin11
Icon for Memorable Member rankMemorable Member
5 years ago
Solved

Problem Statement 3 on GL Analysis :- Sort P&L Field in Sequences

  • admin11 

    Download PBIX file

    OK, because your table was created with DAX I had to modify this code to add the SortOrder column when the table was created

     

    VAR tbl = {(t_rev, 1), (t_cogs, 2), (t_oth, 3) , (t_exp, 4)}

     

    So now you can set the SortOrder in Model view for REV&COGS - I've already done it in the attached PBIX file.

    Regards

    Phil

7 Replies

  • admin11 

    Hi Paul,

    Sorry, slight modification here.

    In Power Query create a new column called SortOrder in the table with this code

    if [REV&COGS] = "REV" then 1 else if [REV&COGS] = "COGS" then 2 else if [REV&COGS] = "OTH" then 3 else 4
    

     

    Which gives you this in the Data Model when you Close & Apply

     

    Then in the Model view click on the REV&COGS column and set the Sort by Column to SortOrder

     

     

    Regards

    Phil

  • Anonymous's avatar
    Anonymous
    Not applicable

    In power query, you can add an index column and then sort the visual.