Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Two conditions met from same field.
Test
1
2
3
4
If(Test = 1 and Test = 3, 1,0) as xzy
Why is this not working?
I need both, not 1 or 1 or the other I need both.
Thanks
Your expression does not make sense, the condition will never be met because a value cannot be equal to 1 and 3 simultaneously.
Try the following...
If(Test = 1 OR Test = 3, 1, 0) AS xzy
Or means one or the other doesn't it?
I need the condition to be test 1 and 3 both selected, if both selected then a yes or no.
Thanks
That's the whole thing, how can I do it to achieve my goal.
I'm trying it via generic table, create a key and join it via a excel spreadsheet lookup table.
Must be an easier way
If the definition of the flag depends on the user's selection, you cannot solve it in script. In what context are you going to use it?
If(Concat(Distinct [Test], ', ') = '1, 3', 1, 0)
It's not selected by a user in the frontend, it's in the data for reporting purposes.
You could apply the same string-aggregation in the script - but you will need an extra group by load for it because an aggregation returns only the expected values if it matched the right context/dimensionality and then you map/join the result back to the target-table or you may keep the table as dimension-table within the datamodel.
- Marcus
Thanks
Do you have the syntax for that or a link to how to do it?
There's so much info on multiple conditions from multiple fields but nothing on multiple conditions on one particular field.
You may apply something like this:
m: mapping load key, concat(test, '+') from source group by key;
final:
load *, if(x = 'condition', 1, 0) as Check;
load *, applymap('m', key, null()) as x from source;
- Marcus
I'll give it a shot.
Thanks