• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

The specified sort criteria is invalid. Details: [List]


Hi. I have the below sreenshot error in M and not sure what is this error.
The step just above the step that is giving the error is:
Table.AddColumn(#"Filtered Rows2", "IsOpen.1", each if [IsOpen] = true then 1 else if [IsOpen] = false then 0 else null)

It would be helpful seeing the data. That being said, I think the problem may be that PQ cannot sort a null value. Maybe change the null to something else, ie. 3 in your if statement.
My take on the issue.
The order seems to happen on a list object. That can't be sorted it seems. It has nothing to do with the if-statement. The column Name is IsOpen.1 and the sort is done on ServiceOrderTypeNK.
So one of the values in that columns appears to be a list object. I assume the data type should be any. If so mark is a text. Then keep errors. That will give the record or records that have the issue.
How to solve it depends largely on the context. It should best be solved in the semantic model that's the source.

PQ can sort on null values:

Stunningly, PQ can sort mixed values too

And if the whole column is a list the sort order is not accessible via the UI.

Back to start :oops:

If the column would only contain lists, the error message seems to be different too.
Last edited:
What I can think of is that query folding is going on, since you are using a data model. Meaning the M-code get's translated into SQL. And it hits the fan somehow?
From the field naming it seems to be a key column, which is useable for data modelling. Do you really need to sort on that column? Is there not a dimension for it? I see you also filter after this sorting step. You can try to inverse those steps. Maybe the thing that causes the sort to fail is filter out and the issue is gone that way.
p45cal, how did you figured that one out?
It's kind of strange that would be the cause for the OP. Look at the code, all is UI default stuff and I surely hope that no-one is going to type in such a long column name from a semantic model.
I'm wondering if the "expand" actions are a potential cause.

Why the sorting is needed, remains a mystery, as we do not see the whole query definition. Without an added index, PQ may well "overwrite" this sorting anyways, so it brings no value at all in many cases.
Not at a PC at the moment, but could it be the user added some steps between existing steps which got rid of that column name before the the sorting?
Thank you all for your time. In the I rebuilt it following same steps. I think that it was an issue with our DB keys in the end but it works now. Not sure why it wasn't though. Thank you