Forum Discussion

cheid's avatar
cheid
Frequent Visitor
5 months ago
Solved

Table Sorting Reset

I am getting the below message no matter what column I sort when using "Sort By Column" in the Table View. Is there anyway to reset these sorts so I can sort by the correct column?  Thanks.

 

 

 

  • I've created that table and it allows me to sort by the KPI Order column, so it seems as if Power BI has got itself out of sync somehow. You could try saving and then closing / reopening the file, to see if it recalculates, or else delete the table and recreate it. You could use the below TMDL to do that.

    createOrReplace
    
    	table Table
    		lineageTag: b0c9a34e-38be-459f-b9e8-e7bc30081e75
    
    		column KPI
    			dataType: string
    			lineageTag: 35618224-93c5-409f-a6e3-a33a2f8715c2
    			summarizeBy: none
    			sourceColumn: KPI
    
    			annotation SummarizationSetBy = Automatic
    
    		column Category
    			dataType: string
    			lineageTag: f0a8f8cd-4fc5-4de8-a549-1abbcdef3e4f
    			summarizeBy: none
    			sourceColumn: Category
    
    			annotation SummarizationSetBy = Automatic
    
    		column 'KPI Name'
    			dataType: string
    			lineageTag: ba7ddb94-c584-4a67-b36d-42dbec301068
    			summarizeBy: none
    			sourceColumn: KPI Name
    			sortByColumn: 'KPI Order'
    
    			changedProperty = SortByColumn
    
    			annotation SummarizationSetBy = Automatic
    
    		column 'KPI Order'
    			dataType: int64
    			formatString: 0
    			lineageTag: 349ebdd0-de85-4a44-86a9-4ce30fcde481
    			summarizeBy: sum
    			sourceColumn: KPI Order
    
    			annotation SummarizationSetBy = Automatic
    
    		column 'Category Order'
    			dataType: int64
    			formatString: 0
    			lineageTag: f2bb5e7a-d02f-47d3-b885-bc220a519989
    			summarizeBy: sum
    			sourceColumn: Category Order
    
    			annotation SummarizationSetBy = Automatic
    
    		partition Table = m
    			mode: import
    			source =
    					let
    					    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fZJNa8MwDIb/ism50Dr9Po6MLIMNxhJ2CT2ENnQBLx5OOrZ/P0u2FbtNegix9b6PbMkqy6iQfSVeZHXqoln0IcXlq2aFqlvco8icyvE7zMrotRH1tN+pseeHHCPAe6Hdcysuyf+ofjJ5UeCAv/gbCC0xp63wEDzgLRvxmuiaXJnq7FHXTq24W2yGpHkKSfL0pkAUtnhla7RwYNYbl3RH3rT5rSGSfFbq7HUC48xE9XaP5Xm9IOUatKWQzheEpnkydhJGOScbFjWZ35Q8pI+JS2TXm1bA6obQsbmR+RKfwTG2J5OQ1fkqoGCq7h5ldL4OKOjOPcrqfENU/i17N2Cw7pv27C1p+PgWh8VHqElj3NDBXQAWqjr2UoWUmQYM2AjfE4XXBy1kTFVeIF4Q8qSq9hS+84MQ7LnVC9QYigBxHG2AwNG0/kOOMb4exwY+/AM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [KPI = _t, Category = _t, #"KPI Name" = _t, #"KPI Order" = _t, #"Category Order" = _t]),
    					    #"Changed Type" = Table.TransformColumnTypes(Source,{{"KPI", type text}, {"Category", type text}, {"KPI Name", type text}, {"KPI Order", Int64.Type}, {"Category Order", Int64.Type}})
    					in
    					    #"Changed Type"
    
    		annotation PBI_ResultType = Table
    
    

5 Replies

  • The issue is that you have multiple entries in the KPI Name column with the same values - there are 2 Totals and 2 Fixed Charges. If you change the duplicate values so that they have distinct names then you will be able to sort by the KPI order column.

    • cheid's avatar
      cheid
      Frequent Visitor

      I caught those after I sent the message and I am still receiving that same message after correcting. 

       

      • johnt75's avatar
        johnt75
        Super User

        I've created that table and it allows me to sort by the KPI Order column, so it seems as if Power BI has got itself out of sync somehow. You could try saving and then closing / reopening the file, to see if it recalculates, or else delete the table and recreate it. You could use the below TMDL to do that.

        createOrReplace
        
        	table Table
        		lineageTag: b0c9a34e-38be-459f-b9e8-e7bc30081e75
        
        		column KPI
        			dataType: string
        			lineageTag: 35618224-93c5-409f-a6e3-a33a2f8715c2
        			summarizeBy: none
        			sourceColumn: KPI
        
        			annotation SummarizationSetBy = Automatic
        
        		column Category
        			dataType: string
        			lineageTag: f0a8f8cd-4fc5-4de8-a549-1abbcdef3e4f
        			summarizeBy: none
        			sourceColumn: Category
        
        			annotation SummarizationSetBy = Automatic
        
        		column 'KPI Name'
        			dataType: string
        			lineageTag: ba7ddb94-c584-4a67-b36d-42dbec301068
        			summarizeBy: none
        			sourceColumn: KPI Name
        			sortByColumn: 'KPI Order'
        
        			changedProperty = SortByColumn
        
        			annotation SummarizationSetBy = Automatic
        
        		column 'KPI Order'
        			dataType: int64
        			formatString: 0
        			lineageTag: 349ebdd0-de85-4a44-86a9-4ce30fcde481
        			summarizeBy: sum
        			sourceColumn: KPI Order
        
        			annotation SummarizationSetBy = Automatic
        
        		column 'Category Order'
        			dataType: int64
        			formatString: 0
        			lineageTag: f2bb5e7a-d02f-47d3-b885-bc220a519989
        			summarizeBy: sum
        			sourceColumn: Category Order
        
        			annotation SummarizationSetBy = Automatic
        
        		partition Table = m
        			mode: import
        			source =
        					let
        					    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fZJNa8MwDIb/ism50Dr9Po6MLIMNxhJ2CT2ENnQBLx5OOrZ/P0u2FbtNegix9b6PbMkqy6iQfSVeZHXqoln0IcXlq2aFqlvco8icyvE7zMrotRH1tN+pseeHHCPAe6Hdcysuyf+ofjJ5UeCAv/gbCC0xp63wEDzgLRvxmuiaXJnq7FHXTq24W2yGpHkKSfL0pkAUtnhla7RwYNYbl3RH3rT5rSGSfFbq7HUC48xE9XaP5Xm9IOUatKWQzheEpnkydhJGOScbFjWZ35Q8pI+JS2TXm1bA6obQsbmR+RKfwTG2J5OQ1fkqoGCq7h5ldL4OKOjOPcrqfENU/i17N2Cw7pv27C1p+PgWh8VHqElj3NDBXQAWqjr2UoWUmQYM2AjfE4XXBy1kTFVeIF4Q8qSq9hS+84MQ7LnVC9QYigBxHG2AwNG0/kOOMb4exwY+/AM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [KPI = _t, Category = _t, #"KPI Name" = _t, #"KPI Order" = _t, #"Category Order" = _t]),
        					    #"Changed Type" = Table.TransformColumnTypes(Source,{{"KPI", type text}, {"Category", type text}, {"KPI Name", type text}, {"KPI Order", Int64.Type}, {"Category Order", Int64.Type}})
        					in
        					    #"Changed Type"
        
        		annotation PBI_ResultType = Table