Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
First time posting and I hope it's in the correct section. Please feel free to move if necessary.
I'm completing the exercises in the Qlik continuous classroom and I came across a step in a certain exercise that I don't understand.
Learning module: Business Analyst > Create Visualizations > Introduction to String Functions
One step in this exercise is to use the following string in a new dimension in order to organize data by region in a Filter Pane.
If(Right(Region,7)='America','Americas','EMEA')
In the Filter Pane there is a dimension "Region" which contains the following values: "Europe", "North America" or "South America"
While the string is working great and returns values North America -> Americas, South America -> Americas, Europe -> EMEA in the new dimension, I'm frustrated because I can't understand how it actually works. I tried looking for similar problems with If statement combined with string function Right but no luck.
Right reads 7 characters from the end of the Region string (from the right). If these 7 characters read America, the if statement returns Americas otherwise it returns EMEA.
There is also Left and Mid that do similar. See help
Right reads 7 characters from the end of the Region string (from the right). If these 7 characters read America, the if statement returns Americas otherwise it returns EMEA.
There is also Left and Mid that do similar. See help
Are you not sure about the Right function or is there anything else you are not sure about?
it's works as expected.
take a look here Right - script and chart function ‒ QlikView
it's just another field created on the fly.
you also do the same in script as below:
LOAD
...
...
If(Right(Region,7)='America','Americas','EMEA') as NewRegion
and use this new field as your chart dimension.
Hey and thanks for everyone's replies. As they are all correct I will mark the first one, it also being most easy to understand.
Ok so If(Right(Region,7)='America','Americas','EMEA') is just an 'if' statement. I was looking at it wrong because I was driven off by the use of 'Right' string in it.
So this is how I now understand it: If (the string of last 7 = "America") then ("Americas") else ("EMEA").