5 Replies Latest reply: Jun 29, 2016 6:53 AM by Sunny Talwar RSS

    Month Over Month Comparison of string Fields

    Deepak Sharma

      Hi

       

      I have a requirement to compare string fields over the months for any change in the string value.

       

      For Example :

       

      I have to compare the status of countries and have to color the background if there ia any change in status.

      For india status is "Hign" in May and changed to "Low" in June so I have highlight the change.

       

      Month              Country               Status

      --------------------------------------------------------

      May                 India                    High

      June                India                    Low

      July                 India                    Low

      May                 Japan                  Low

      June               Japan                   Low

      July                Japan                   Low

       

      Can some one help me out . This is urgent!!

        • Re: Month Over Month Comparison of string Fields
          Sunny Talwar

          Like this?

           

          Capture.PNG

           

          Used the following script to create a flag:

           

          Table:

          LOAD Month(Date#(Month, 'MMMM')) as Month,

            Country,

            Status;

          LOAD * INLINE [

              Month,              Country,              Status

              May,                India,                    High

              June,                India,                    Low

              July,                India,                    Low

              May,                Japan,                  Low

              June,              Japan,                  Low

              July,                Japan,                  Low

          ];

           

          FinalTable:

          LOAD *,

            If(Country = Previous(Country) and Status <> Previous(Status), 1, 0) as Flag

          Resident Table

          Order By Country, Month;

           

          DROP Table Table;

           

          and then used the following background expression:

          =If(Flag = 1, LightRed())