Forum Discussion
Anonymous
3 years agoNot applicable
Create DAX/ Power Query column from a column with different items
I want to create a column from another column. The column has Numerical values and Text Values hence can only be stored in text values. The column is as follows and the column next to it is my ask. ...
- 3 years ago
Hi Anonymous ,
You can try this method:
New a column:
Desired Column = IF ( MID ( 'Table'[Item Code ], 1, 3 ) = "100", "Item", IF ( MID ( 'Table'[Item Code ], 1, 3 ) = "600", "Parts", "Labour" ) )The result is:
Hope this helps you.
Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mangaus1111
3 years agoSolution Sage
Hi Anonymous ,
add a conditional column using this code
#"Added Conditional Column" = Table.AddColumn(#"Removed Top Rows", "Custom", each if Text.StartsWith([#"Item Code "], "1") then "Item" else if Text.StartsWith([#"Item Code "], "6") then "Parts" else "Labour")
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
3 years agoNot applicable
- v-yinliw-msft3 years agoCommunity Support
Hi Anonymous ,
You can try this method:
New a column:
Desired Column = IF ( MID ( 'Table'[Item Code ], 1, 3 ) = "100", "Item", IF ( MID ( 'Table'[Item Code ], 1, 3 ) = "600", "Parts", "Labour" ) )The result is:
Hope this helps you.
Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.