Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Flag based on value on multiple rows

Hi,

 

I have a data set that contains a unique value for each customer as well as a column which indicates what offer they received as well as the method of communication (channel).  For example;

 

IDOfferReceived LetterReceived EmailReceived Phone Call
120% offYNN
120% offNNY
215% offNYN
215% offNNY
220% offYNN
315% offYYN
320% offNYN
350% offYNY

 

   
   
   
   
   
   
   
   
   
   

 

What I need to do is create a column/columns which provide me with the channel combinations.  For example, in the above, customer number 1 has received a letter and a phone call for the same offer, so ideally i would liek to be able to have a flag that indicates that they have received this combination (letter & phone call).  The most important thing though is that this would need to be based on the same offer, as some customers may receive a letter and a call for different offers.

 

Ideally I'd love it to look like this

 

 

     Based on ID & Offer
IDOfferReceived LetterReceived EmailReceived Phone CallLetter OnlyEmail OnlyPhone Call OnlyLetter & Phone CallLetter & EmailEmail & Phone Call
120% offYNNNNNYNN
120% offNNYNNNYNN
215% offNYNNNNNNY
215% offNNYNNNNNY
220% offYNNYNNNNN
315% offYYNNNNNYN
320% offNYNNYNNNN
350% offYNYNNNYNN
  • Like this? See last row, a duplicate of the first row with a Y added to Email

     

17 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    What if it looked like this for ID 1?

     

         Based on ID & Offer
    IDOfferReceived LetterReceived EmailReceived Phone CallLetter OnlyEmail OnlyPhone Call OnlyLetter & Phone CallLetter & EmailEmail & Phone Call
    120% offYNYNNNYNN
               
               
               
               
               
               
               
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      that would be perfect. Any suggestions would be much appreciated.

       

      Thanks

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        You should be able to create measures like this:

         

        Email Only = 
        VAR tmpTable = SUMMARIZE(Table8,[ID],[Offer],"RL",MAX([Received Letter]),"RE",MAX([Received Email]),"RP",MAX([Received Phone Call]))
        VAR RL = MAXX(tmpTable,[RL])
        VAR RE = MAXX(tmpTable,[RE])
        VAR RP = MAXX(tmpTable,[RP])
        RETURN IF(RL="Y" && RE="N" && RP="N","Y","N")