Forum Discussion

IainPowerBI's avatar
IainPowerBI
New Member
4 years ago

Move Column Headings In Matrix - Power Bi Desktop

Hi,

 

I am really struggling to move my headings in the matrix below.  As you can see this needs to be sorted in the correct format but I am unable to find a way to do this.  Any help would be greatly appreciated.

 

1 Reply

  • TheoC's avatar
    TheoC
    Community Champion

    Hi IainPowerBI 

     

    Did you create your "groups" in Power Query, Calculated Columns or via the Group tool?

     

    The end result you need is to create a rank for each of the group's you have created.   Below is a Calculated Column you can use for this. Just add the Group Names, followed by the rank order (i.e. 1, 2, 3, 4, 5.... ) and on the last one, ensure you end it with " , 0 ) "

     

    Rank = 

    SWITCH (
    TRUE () ,
    'Table'[Group] = "0" , 1 ,
    'Table'[Group] = "1" , 2 ,
    'Table'[Group] = "2" , 3 ,
    'Table'[Group =
    "3-5" , 4 ,
    'Table'[Group = .... ,
    0
    )

    Once you do this, you can then click on your Group button in the Field pane and go to the Sort By Column button in the ribbon.  Sort by the new Rank column, and you're done πŸ™‚

    All the best!

    Theo