How can I add a row number for a specific field

0 votes

Sample Data in SQL:

DOB         Status       Policy StartDate   EndDate
1/05/1983   Lapsed       P1     5/05/2015   5/06/2016
1/05/1983   New Business P2     3/05/2016   
2/04/1999   Lapsed       P3     5/02/2016   10/06/2017
2/04/1999   New Business P4     10/07/2017  
3/06/1972   Lapsed       P5     6/07/2016   15/12/2017
3/06/1972   New Business P6     1/10/2017   
4/12/1954   Lapsed       P7     7/03/2017   1/03/2018
4/12/1954   New Business P8     1/03/2018   

Goal: Add descending number based on DOB field. The expected result suppose to be like below.

enter image description here

Unfortunately I only can get number '1' in column #.

For column #, I have tried using index(), Window_Count (Countd(DOB), 04,0), Runnning_Total (Table Down, Pane Down, Specific Dimension : DOB), however nothing works.

I'm using Tableau desktop/server 10.0.

Apr 17, 2018 in Tableau by xyz
• 1,560 points
1,232 views

1 answer to this question.

0 votes

Hi @Noob,

You can use RANK_DENSE function:

"The function returns the dense rank for the current row in the partition. If the values are identical they are assigned an identical rank, but no gaps are inserted into the number sequence. You can use the optional 'asc' | 'desc' argument and specify descending or ascending order. By default it is descending.

For example: set of values (6, 9, 9, 14) would be ranked (3, 2, 2, 1)."

Following is the query you want:

RANK_DENSE(SUM(FLOAT([DOB])),'asc') 

enter image description here

answered Apr 17, 2018 by ffdfd
• 5,550 points

Related Questions In Tableau

0 votes
0 answers

How can I add a connection between Mongodb and Tableau

What I want? Parse the XML to JSON ...READ MORE

May 18, 2018 in Tableau by ghost
• 1,790 points
619 views
0 votes
0 answers

How can I sort date field in presence of another date field in Tableau?

Goal: Sort the new ship date in ...READ MORE

Apr 10, 2018 in Tableau by ghost
• 1,790 points
1,181 views
0 votes
1 answer

How can I add legends to worksheet in Tableau?

Just add the worksheet on the dashboard ...READ MORE

answered Apr 21, 2018 in Tableau by ffdfd
• 5,550 points
6,307 views
0 votes
1 answer

How can I create a second sheet which is filtered to 8 days ago,

Following are the steps you can follow: Create ...READ MORE

answered Jul 11, 2018 in Tableau by ffdfd
• 5,550 points
639 views
0 votes
1 answer

How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
9,444 views
+2 votes
1 answer
0 votes
1 answer

Calculated filed with if-then

Below is the required code:  IF (NOT ISNULL([test2])) ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
1,313 views
+2 votes
1 answer
0 votes
2 answers

How can I add text in the centre of a Donut Chart ?

Hi, You can read this for creating a donut ...READ MORE

answered Apr 4, 2019 in Tableau by Cherukuri
• 33,030 points
11,547 views
0 votes
1 answer

How can I use Tableau to create a heatmap?

Step 1: Create an Excel Spreadsheet with ...READ MORE

answered Apr 2, 2018 in Tableau by ffdfd
• 5,550 points
2,620 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP