Forum Discussion
VAR and SWITCH in Create New Column error
You did everything exactly right IF you were creating a calculated column in DAX BUT as you mentioned you wrote this in the query editor which uses the M language. Copy that formula, load the query and then go to the table and add a calculated column with that exact same logic.
Alright!! At least the DAX looks right. I'll take a look at M and see what might do the trick there since I would then never have to think about it again on data refresh. I'm guessing an intermediate col would be useful and then not load it....to break it into pieces.
Thanks again, and I'll try out the code above just for the satisfaction of it and then crack the M book. Tom
- ThomasDay10 years agoImpactful Individual
I really should ask: "do you have any tips for the approach in M?" Is it to create a temp column and build a big nested IF (presuming there is such a thing in M)? Thanks for any help in advance. Tom
- austinsense10 years agoImpactful Individual
The nested IF statement is probably a good place to start - here's a more complex way to do it LINK but I wouldn't start with this approach.
- ThomasDay10 years agoImpactful Individual
Austin, the fnSwitch is a really nice learning exercise. I've not finished, it's a nice view forward into M's capabilities. I am going to do the Monkey thing and replicate it as a "pattern" piece of code and try it out....and then backfill my understanding of it. If I can get it to work, that would be a nice resource for my snippets collection.
Thanks,
Tom