Forum Discussion
Custom Column with 'M' ('and' with double 'or' condition) Help Needed
Hi All!
3 month lurker, first time poster. Needing a little help with a buildout of a custom column used as a market identifier to separate work streams.
I feel like I'm super close, but I'm going round and round trying to get a proper result and can't seem to lock it in.
The solution is this:
Mark '1' for any county in the Charlotte, Philly, or VB metros. Also mark '1' for any county in the Atlanta metro, with the exception of dekalb and fulton.
The M I've got looks like this:
...but I'm not getting the expected result. It seems to be ignoring the county identifier altogether and defaulting ALL Atlanta counties to '1':
If I yank either side of the 'or' however... (in this case "fulton")
...it does perform as expected and removes the dekalb entries.
Can anyone identify what I'm overlooking in the M syntax to put this to rest? Am I backwards somehow on the order of operations?
Appreciate the insight!
Anonymous
What if you split the first test into two and reverse them like so:
if [Metro] = "Atlanta" and [county_name] = "dekalb" then 0 else if [Metro] = "Atlanta" and [county_name] = "fulton" then 0 else if [Metro] = "Atlanta" or [Metro] = "Charlotte" or [Metro] = "Philadelphia" or [Metro] = "Virginia Beach" then 1 else 0
Does that work?
9 Replies
- Nathaniel_C
Community Champion
Anonymous ,
Nicely laid out issue! Not sure of the answer, but from a pure testing point of view, maybe try if Atlanta and not dekalb, or if atlanta and not fulton. Change the order of the test. Or if you have time, give the results different numbers for testing.
If this solves it great, if not, maybe reach out to imkeF. She is a magician with m.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel- AnonymousNot applicable
Thanks for the follow-up!
Sadly, yes, that combination has been tried along with any other order I could think of that made sense programmatically.
Appreciate the referral, I'll definitely reach out while I keep digging.
- Nathaniel_C
Community Champion
I am always trying to solve, if for some reason the m language has a glitch, then how about intermediate columns for part of the logic, and then gather up the results in this column?
Nathaniel