3 Replies Latest reply on Nov 27, 2016 7:22 AM by Marc MOUSSA

    How to color code the most profitable and least profitable month of each year based on the total no of profitable days?

    Simi TS

      I have created a bar chart using the super stores data to show the no of profitable days in each month of the year. Now I want to show the month with the most no of profitable days and the one with the least no of profitable days in different colors. For this I used the rank function.

       

      if Rank(Sum(Profit)) =1  then "Most Profitable month" elseif Rank(Sum(Profit)) =12 then "Least Profitable month" end

       

      Now for one year 2012 , the lowest no of profitable days is for May (only 13 days), but my graph shows the month of march (15 days) as the least one. This is because in the rank function I have used profit to calculate the rank and profit for the march month is more than that for May . Actually I wanted to rank based no t on the profit but on the no of profitable days . Is there any function in tableau to do this?  Please guide.