2 Replies Latest reply on Jul 1, 2016 10:16 AM by Tam Nguyen

    Show latest week, based on records comparison between latest and previous weeks

    Tam Nguyen

      Hello Tableau Community,


      I've a question on how to show records for the latest week, based on comparison of records between latest week and previous week. The requirement is:


      1) For the latest week, if the number of products within the category is the same or more than those in previous week, then show products in the latest week.


      2) However, if the number of products within the category is fewer than those in the previous week, then show products in the previous week.


      This is the raw data:                                                                   The result should look like this:

      Category    Fiscal Week    Week Index    Product                      Category      Week Index      Product

      Drink            FY16W20            1                 7-Up                          Drink               1                    7-Up

                                                                         Coke                                                                       Coke

                                                                         Pepsi                                                                       Pepsi

                          FY16Y19             2                 Coke

                                                                         Pepsi                          Fruit                1                    Grape


      Fruit             FY16W20            1                 Grape                                                                       Peach


                          FY16W19            2                 Grape




      Detailed question is inside attached workbook.  Looking forward to your input.