Forum Discussion

chrismoncrief's avatar
chrismoncrief
Frequent Visitor
1 year ago
Solved

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 all...
  • PwerQueryKees's avatar
    1 year ago

    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"})

     

  • rohit1991's avatar
    1 year ago

    To create the Allocation Pallets column in Power Query:

    1. Add Conditional Column: Go to Add Column > Conditional Column.

      • Set:
        • Column Name: Allocation Pallets.
        • Condition: Inventory Status = "Allocation".
        • Output: Pallets.
        • Else: 0.
    2. Formula Alternative: Use this formula if editing directly: = Table.AddColumn(Source, "Allocation Pallets", each if [Inventory Status] = "Allocation" then [Pallets] else 0)