Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago

multi column sort

How can we sort a table using two or more columns?

 

I want to sort by fiscal year order first and then by size of deal next (large to small).

13 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi OwenAugerv-qiuyu-msft,

       

      Thanks for your replies. If im not wrong, these work if both the columns have values.

       

      In my case, I have one column wit Text (Fiscal Period) and then values. I tried to use below DAX, but got the following error - 

       

      "A single value for column 'Sort By Fiscal Year' in table 'SFDC' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."

       

      Any idea how to correct this?

       

      Final Rank = RANKX (
      ALL (SFDC),
      RANKX ( ALL (SFDC), SFDC[Sort By Fiscal Year],, ASC )
      + DIVIDE (
      RANKX ( ALL (SFDC), SFDC[Value USD],, DESC ),
      ( COUNTROWS ( ALL (SFDC)) + 1 )
      )
      )

      • OwenAuger's avatar
        OwenAuger
        Super User

        Anonymous

        Could you post an excerpt of the relevant table?

        Also, just to clarify, are you creating a measure or calculated column?

  • Tables only support single column sorting in  Power BI. For multi column sorting, use matrix visual.