Forum Discussion
Add Custom column based on string in another column (if device = "iPhone" or "iPad" then do this)?
- 7 years ago
astrbac If you just looking for the new column "Correct Total Sales" logic, then please add "Custom Column" in Power Query as below:
if List.Contains({"iPhone","iPad","iPod"},[Platform]) then ([MobileSales]/2) + [WebSales] else [MobileSales] + [WebSales]
Oh... I see this will not be as simple as I thought it would. This might be a bit over my head, as it looks like C# or some similar language, with which I have no experience.
I thank you all for the effort and your time but I don't know which reply to accept. I cannot use this because I don't fully understand it. All of the pivots that would be build on top of this might be incorrect i make some errors with other connections and/or when refreshing the data.
Thanks all once again!
Alex
astrbac This is "M Query" Language, This will be generated automatically for all the steps that will be perfomed in Power Query. (For advanced functionality, one can write the code directly in M code as well). For sharing the solution (Power Query) this is the simple way of sharing the steps performed. You simply paste this code in the "Advanced Editor" which will then show the all the steps that was involved in this on right side under "Applied Steps".
Please try to make your hands dirty with "Power Query" then you can understand it better....