Loading

Dynamically Ranking Rows by Most Recent Data

Udgivelsesdato: Mar 22, 2026
Opgave

How to dynamically sort and rank rows using calculated fields

Trin

The example below can be found in the attached workbook, which uses the Sample Superstore data source.

 

  • Create a Calculated Field [LookupValue]

    LAST()

    This calculation returns the number of marks from the current position to the last mark in the partition. When Compute Using is set to Table Across, the rightmost column returns 0.

 

  • Create a Calculated Field [Across_Value]

    WINDOW_SUM(IIF([LookupValue]=0,SUM([Sales]),0))

    This calculation checks each column for the value of LAST(). If the result is 0, meaning it is the last column in the partition, it keeps that measure value; otherwise it returns 0. WINDOW_SUM() then sums across the row, so the last-column value is available across the partition.

    Set Compute Using for [Across_Value] to Table Across.

 

  • Create a Calculated Field [Rank]

    RANK([Across_Value])

    This ranks each row based on the value from the rightmost column in the view.

    Set Compute Using as follows:

    • [Rank]Table Down
    • [Across_Value]Table Across
    • [LookupValue]Table Across

    Then place [Rank] on the worksheet as a discrete measure on the far left, and hide the header if needed.

Vidensartikelnummer

001458323

Vedhæftede filer

sample_sort_last_month.twbx

1201 KB

 
Indlæser
Salesforce Help | Article