Forum Discussion
Power BI time functions
- Anonymous3 years ago
Hi Npg3 ,
You can try M Code as below.
Date.AddMonths( [Column A], if [Column B] = "AOT" then 6 else if [Column B] = "XYZ" then 3 else if [Column B] = "ABC" then 1 else null)Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
How can I create this function in a custom column in power BI?
Hi Npg3 ,
You can try M Code as below.
Date.AddMonths(
[Column A],
if [Column B] = "AOT" then 6
else if [Column B] = "XYZ" then 3
else if [Column B] = "ABC" then 1
else null)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Npg33 years agoNew Member
This works but the problem is if I want column B to have AOT and ABC in one row it does not work. The way the data is pulled in is in some rows of columb B they have multiple (codes). How do I have power bi choose the code with the lowest timeframe. I tried using LOOKUPVALUE but it will not recognize LOOKUPVALUE people have been using power querey for that function which I do not have. Any advice?