Skip to main content
Garen Xia 님이 #Tableau Desktop & Web Authoring에 질문했습니다

Hi,

 

I am trying to find the top N within a category using a calculation field.

I referred to the following article, but when the category is created by a calculation field,

I could not rank each category well as I expect. I could only get the rank of the whole table.

 

https://kb.tableau.com/articles/howto/finding-the-top-n-within-a-category?lang=en-us

 

I attached the sample workbook.

     [group] is a calculation field to separate the [cumulative amount]

     I wish to filter the top 1 within each [group] so I tried to use RANK and INDEX.

 

The attached picture is showing what I expect, but the [group] category is a dimension existing in the data source.

 

Thanks for any suggestions!

 

Best Regards

답변 5개
  1. 2018년 10월 7일 오전 7:18

    Hi Garen,

     

    I took a look at your workbook. As the group is a calculated field and cannot be converted to dimension, Tableau is not allowing to rank it properly. You can set this up in your db such that it generates a dimension that you can use in the view. Just to give an idea, I created a dummy dim field in the attached workbook and it seems to work correctly. This is a kind of manual hard coding and might not work when you get more values. So my suggestion is to create this group in your DB and bring that up in Tableau.

     

    Hi Garen, I took a look at your workbook. As the group is a calculated field and cannot be converted to dimension, Tableau is not allowing to rank it properly.

     

    Hope that makes sense.

     

    ~Tushar

0/9000