Forum Discussion
IF-Then using columns
I am trying to create a query that would return values from a column based upon the label from another column.
In the column for Allocation Pallets I am looking that any line that shows allocation then place the qty from Pallets` into the allocation pallets column.
Try this in the formula bar and replace #"Changed Type" with the name of the previous step.
= Table.ReplaceValue(#"Changed Type", each if [Inventory Status] = "Allocation" then [Allocation Pallets] else false, each [Pallets],Replacer.ReplaceValue,{"Allocation Pallets"})To create the Allocation Pallets column in Power Query:
-
Add Conditional Column: Go to Add Column > Conditional Column.
- Set:
- Column Name: Allocation Pallets.
- Condition: Inventory Status = "Allocation".
- Output: Pallets.
- Else: 0.
- Set:
-
Formula Alternative: Use this formula if editing directly: = Table.AddColumn(Source, "Allocation Pallets", each if [Inventory Status] = "Allocation" then [Pallets] else 0)
-
4 Replies
- PwerQueryKeesSuper User
Try this in the formula bar and replace #"Changed Type" with the name of the previous step.
= Table.ReplaceValue(#"Changed Type", each if [Inventory Status] = "Allocation" then [Allocation Pallets] else false, each [Pallets],Replacer.ReplaceValue,{"Allocation Pallets"}) - rohit1991Super User
To create the Allocation Pallets column in Power Query:
-
Add Conditional Column: Go to Add Column > Conditional Column.
- Set:
- Column Name: Allocation Pallets.
- Condition: Inventory Status = "Allocation".
- Output: Pallets.
- Else: 0.
- Set:
-
Formula Alternative: Use this formula if editing directly: = Table.AddColumn(Source, "Allocation Pallets", each if [Inventory Status] = "Allocation" then [Pallets] else 0)
-
- AnonymousNot applicable
Hi chrismoncrief ,
Thank you for the helpful answer rohit1991 and PwerQueryKees .
I just wanted to kindly follow up to see if you had a chance to review the previous response provided by community members. Please let us know if it was helpful. If yes, please Accept the answer so that it will be helpful to others to find it quickly. - AnonymousNot applicable
Hi chrismoncrief ,
We haven't heard back from you regarding our last response and wanted to check if your issue has been resolved.If community member response addressed your query, please mark it as Accept as Solution and click Yes if you found it helpful.If you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!