Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Error: Tied rows detected in the relation parameter for ROWNUMBER function

Just attempted to add a new table as follows:

_RankSteps2 =
ADDCOLUMNS(
    STEPS_COMPLETED_SUMMARY
    , "MyRank"
    , ROWNUMBER(
            STEPS_COMPLETED_SUMMARY,
            ORDERBY(
                IF( ISBLANK(STEPS_COMPLETED_SUMMARY[End Date]), TODAY(), STEPS_COMPLETED_SUMMARY[End Date]), DESC
                , STEPS_COMPLETED_SUMMARY[Start Date], DESC
                ),
            PARTITIONBY(STEPS_COMPLETED_SUMMARY[Person Id])
            )
)


and I get this error  "Tied rows detected in the relation parameter for ROWNUMBER function", not sure what the issue is, but it seems like it's an Error as PBI is reporting it as such?

Status: Investigating

Hi,@dahya_mistry .I am glad to help you.
Your error message shows that:

“Tied rows detected in the relation parameter for ROWNUMBER function”.

This means that when using the ROWNUMBER function, there are multiple rows with the same sort criteria, making it impossible to determine a unique order.
This situation is also mentioned in the function limitations of the official documentation of the ROWNUMBER function.
URL:

ROWNUMBER function (DAX) - DAX | Microsoft Learn

vjtianmsft_0-1739942147964.png

If two or more rows have the same End Date and Start Date. tied rows will appear. you can introduce a column with a unique value as an additional sort criterion to ensure the uniqueness of the sort criteria.
URL:

Solved: Row_Number in column with DAX - Microsoft Fabric Community
Or use RankX function:

Power BI DAX Functions - RANK and ROWNUMBER - MSSQLTips.com

Your code might look like this: (what I provided is just a test case, the specific DAX code you need to modify for your real environment)

_RankSteps2 =
ADDCOLUMNS (
    STEPS_COMPLETED_SUMMARY,
    "MyRank",
        ROWNUMBER (
            STEPS_COMPLETED_SUMMARY,
            ORDERBY (
                IF (
                    ISBLANK ( STEPS_COMPLETED_SUMMARY[End Date] ),
                    TODAY (),
                    STEPS_COMPLETED_SUMMARY[End Date]
                ), DESC,
                STEPS_COMPLETED_SUMMARY[Start Date], DESC,
                STEPS_COMPLETED_SUMMARY[Person Id] -- Add unique sorting criteria
            ),
            PARTITIONBY ( STEPS_COMPLETED_SUMMARY[Person Id] )
        )
)


I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian

Comments
v-jtian-msft
Community Support
Status changed to: Investigating

Hi,@dahya_mistry .I am glad to help you.
Your error message shows that:

“Tied rows detected in the relation parameter for ROWNUMBER function”.

This means that when using the ROWNUMBER function, there are multiple rows with the same sort criteria, making it impossible to determine a unique order.
This situation is also mentioned in the function limitations of the official documentation of the ROWNUMBER function.
URL:

ROWNUMBER function (DAX) - DAX | Microsoft Learn

vjtianmsft_0-1739942147964.png

If two or more rows have the same End Date and Start Date. tied rows will appear. you can introduce a column with a unique value as an additional sort criterion to ensure the uniqueness of the sort criteria.
URL:

Solved: Row_Number in column with DAX - Microsoft Fabric Community
Or use RankX function:

Power BI DAX Functions - RANK and ROWNUMBER - MSSQLTips.com

Your code might look like this: (what I provided is just a test case, the specific DAX code you need to modify for your real environment)

_RankSteps2 =
ADDCOLUMNS (
    STEPS_COMPLETED_SUMMARY,
    "MyRank",
        ROWNUMBER (
            STEPS_COMPLETED_SUMMARY,
            ORDERBY (
                IF (
                    ISBLANK ( STEPS_COMPLETED_SUMMARY[End Date] ),
                    TODAY (),
                    STEPS_COMPLETED_SUMMARY[End Date]
                ), DESC,
                STEPS_COMPLETED_SUMMARY[Start Date], DESC,
                STEPS_COMPLETED_SUMMARY[Person Id] -- Add unique sorting criteria
            ),
            PARTITIONBY ( STEPS_COMPLETED_SUMMARY[Person Id] )
        )
)


I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian