Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I can't get a nested if to work in the script, i know its something stupid i am doing but can't figure it out.
What i want is
I have a field 'Employee', 'Type' and a 'Date'. I don't want to see any employees with a type of 'A' or 'B' before 01/01/2017. I want to see any other type before this date though and everything after it.
can anyone help?
Where not (Match(Type, 'A', 'B') and Date < MakeDate(2017,1,1))
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
I now have it working, i used..
if(not match([Type],'Basic Training') and [Date]<'01/01/2015',[Type],
if([Date]>='01/01/2015', [Type])) as [New Type]
Where not (Match(Type, 'A', 'B') and Date < MakeDate(2017,1,1))
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
Hi Rob,
I am trying to create a field in the table, so something like...
If(Not Match(Type,'A','B') and Date <01/01/2017,Type) as NewType
So that gives me any other type and dates before 01/01/2017, but i then don't get anything after that date, I also want ALL types after that date too.
The other option is to use an expression in the chart but i can't get that working either..
I now have it working, i used..
if(not match([Type],'Basic Training') and [Date]<'01/01/2015',[Type],
if([Date]>='01/01/2015', [Type])) as [New Type]
Note in my original example the "not" was outside a set of parens. That is key.
if(not (match([Type],'Basic Training') and [Date]<'01/01/2015'),[Type]) as [New Type]
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
Hi Rob,
Ahh yes, i see what you mean. That works, the one i posted also seems to do what i want, would there be a difference? should i change it to the one you suggested or is mine good enough?
Either one seems to work but I find mine easier to read. Perhaps an even clearer way to write it is:
if(match([Type],'Basic Training') and [Date]<'01/01/2015', null() ,[Type]) as [New Type]
-Rob