Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to convert string (text) to an integer

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?

1 Reply
sunny_talwar

In Qlik Sense, you can try this:

RangeSum(Match(Odds, 'Lose', 'Win'), - 1) as Win_Flag