1 Reply Latest reply on Aug 1, 2018 5:46 AM by Jim Dehner

# Top N and Bottom N for two different measures in the same graph

Hi,

I am pretty new to Tableau so I apologise in advance if this is a pretty straightforward request:

I want to be able to create a bar chart that shows the Top 5 inflows/gains and Bottom 5 outflows/losses for products so that I can get a visual like this (where green represents the inflows and red the outflows):

The inflows and outflows are two different measures in my data set, so I am not sure how to create the combined graph. I can create one or the other using ranking, but not both together.

Any help or advice would be much appreciated!

• ###### 1. Re: Top N and Bottom N for two different measures in the same graph

Good morning

First welcome to the forum

Can't be too specific without seeing your TWBX workbook (see the link Getting Started in the Forums )

in general one way to solve the problem is to create 2 rankings - one ascending the other descending -   rank desc = rank_unique(sum(measure 1),'desc') and rank asc =      rank_unique(sum(measure 2),'asc') and then use a conditional statement like [rank asc] <+5 or [rank desc]<=5   as a filter set to true

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.