1 Reply Latest reply: Oct 27, 2016 12:03 PM by Sunny Talwar RSS

    how to convert string (text) to an integer

    Claire Camilleri

      hi,

       

      I am playing around with a dataset I downloaded from the Internet to learn more about Qlick Sense. This table contains the horse name, the Result (if the horse won or lost) plus some other info.

       

      I would like to create some graphs based on the Result column. The result column only contains the strings 'Won' or 'Lost'. I would like to convert this to an integer so I can do measures on it. For example I would like that the Won is converted to a 1 and the Lost is converted to a 0 so I can count the amount of Wins and see how many races a horse has won.

       

      I thought about trying to do it in a case statement, but I am not sure if the case statement I wrote is actually correct or if maybe there is a better way of how to do this?

       

      =if(match([Odds],'Win', '1',

      if(match([Odds],'Lose', '0',

      'OTHER'))))

       

      Any advise please?