Please see the attached spreadsheet and my earlier question. I have a table of stock portfolios, where the key is Date + Portfolio code + StockID. Thus for each date, I would have several portfolios, each of which would have many stocks. Of course, the stocks would repeat between portfolios, as the portfolios would repeat between dates.
I am trying to display the Top 5 highest risky stocks in the portfolio. The sections highlighted in blue in the attached excel worksheet shows the incorrect ( which is what I get from Tableau) and the correct ranking. Instead of showing the top 5 risky stocks for the given date and the given portfolio, Tableau sums up across the entire table (all portfolios across all dates) - finds the top 5 risky stocks - and then if these exist in the given portfolio display them. Thus for any portfolio I can get 0 to 5 bars, depending upon whether or not that stock exists in the portfolio.
Is there a way to calculate the nth Top risk? This way I can have 5 separate line charts, showing each of the 5 top risky names in the current portfolio separately. For example, chart 2 would show how the risk of the second riskiest stock in the portfolio evolved over time.
There are all kinds of Top N related questions/answers and tips throughout the site. If you haven't don so yet, please navigate to
to see a list of all of them and then finding one that applies. You might just find what you're looking for.