KNOWLEDGE BASE

FIXED Function Does Not Work Correctly When Using the Number of Rows With ROW_NUMBER() Function


Published: 31 Oct 2023
Last Modified Date: 06 Nov 2023

Issue

A calculation field with FIXED in Tableau Prep Builder to get the MAX number of a measure. However, the calculated result is not correct.
Specifically, the following calculated fields are outputting unexpected values.
{ FIXED [RowNumber],[Month]: MAX([Value])}

This does not happen each time when opening the flow, the FIX value changes and sometimes the issue is not repro.

In the below example, the value of [FIX confirm] must be the maximum value of the same  [RowNumber] and [Month].
However, a different value has been filled in for the [FIX confirm] field unexpectedly.
User-added image

Environment

  • Tableau Prep Builder
  • FIXED
  • ROW_NUMBER()

Resolution

Please use the below options to revise the flow.

Option 1
Using the Source Row Number feature of v2023.1 and above to generate the row number for the fixed function.

Option 2
Add more fields to ORDERBY function to get a predictive ordered result for row number.

Option 3
Remove RowNumber from the FIXED function.

Cause

This is by design. 
The RowNumber field is calculated by returning the ROW_NUMBER() function over the Department field. It will return a unique sequential number based on that field.
However, since the Department field has only two values, the ORDERBY will not guarantee any order for any other field in the data source.
User-added image
Did this article resolve the issue?