Explore Courses Blog Tutorials Interview Questions
0 votes
in BI by (22.5k points)
recategorized by

How can I create top 10 and bottom 10 records and i have used the following formula for the creation of the record and facing errors while creating them

IF [Index] >= 1 AND [Index] <= 10 
    THEN 'Top' 
ELSEIF [Index] >= (WINDOW_MAX([Index]) - 10 )
    THEN 'Bottom'
    'Do Not Display'

1 Answer

0 votes
by (11.1k points)
edited by

Try to follow these steps:

Step 1:Create a calculated field named index and type index()

Step 2: Place the name field and calculated field into the row shelf

Step 3: click on the name and sort it in descending order via the field

Step 4:with integer data type creates a parameter TOP N

Step 5: Create a calculated field called TOP N and enter this formula

if [Index]<=[Top N] THEN "Top N" ELSE IF [Index]>=SIZE()-[Top N] THEN "Bottom n" END

Step 6: Drag top 10 into the filter and select top n and bottom n

Step 7: Drag the new calculation into the rows

If you want to learn more about it Tableau, then go through this Tableau Training for more insights.  

Browse Categories