Combining filtering and dynamic ranking in a table

My question is this: suppose I have a dataset where I have 4 fields

  • the date
  • A type
  • Amount (metric 1)
  • Sale price (metric 2)

These 4 fields are displayed in a table on the Tableau toolbar. When I click on any element of the table, I would like the text at the top to display the rank of both metrics and the Unique indicator of indicators in my table as well as their values.

eg. 'Amount = 32,500: 4 out of 342, Sale price = $ 2,5: took 2nd place out of 6 (I only have 6 different sale prices)

I would also like the implementation to be dynamic, so when I filter the date, the result will be adjusted, for example, 'Amount = 32 500: 1 place out of 10, Sale price = $ 2.5: In the rating 1 of 4'

I tried using the RANK function, but whenever I click on a row in my table, it effectively filters out all the rest of the data and sets the rank to 1.

Is there any way to do this?

+5
source share
2 answers

I think that you cannot do what you described. As you rightly said, the RANK() function gives you a rank in the current "section", that is, data that is actually displayed on the control panel. If you exclude, for example. a row with rank 1, a row with rank 2 will now be 1.

There is no way to calculate this based on the rank in the data source (unless you are doing this outside the table).

If you have a rank in the data source, you can create a panel with four different sheets (full table, total, rank, number of records) and filter the last 3 based on the selection in the first.

As a workaround, you can display these values ​​in the tooltip.

  • Create the [NumberofRecords] field using the Size() formula
  • Drop [NumberofRecords] , [Rank] and [Amount] onto the instrument shelf.
  • Organize them, but you want to

As an example, this might look like this: enter image description here

+4
source

Chris

Try using the INDEX () function rather than RANK (). For example, if you show results for the year, your value of $ 32,500 can be estimated at 123 out of 1,000. When filtering by a specific day, the "Rank" value will change to the corresponding rank during that day. Not sure if this is exactly what you were looking for. Here is a tutorial video on this topic. Hope this helps.

Using an index to rank in a table: video link

UPDATE:

For ranking and metric rating:

  • Add price field to rows
  • Change attribute price field instead of dimension
  • Make it discreet
  • Click the "Price" field in the "Rows" section, select "Quick table calculation"> "Rank" from the drop-down list

To check the data, you can add another discrete field β€œPrice” to the right of the ranking calculation. Everything should work here, as expected.

Toolbar with all the data.

Dashboard with data filtered on a single date

In addition, I generated a quick example in the following link using tableau supermarket sales data.

Example Project Using Tableau Supermarket Sales Data

Eric

+2
source

Source: https://habr.com/ru/post/1247224/


All Articles