Forum Discussion

jwint's avatar
jwint
Frequent Visitor
4 years ago
Solved

Beginner question

Hello, 

 

I have a dataset with 4 columns showing deliveries to our facility.  One for the date , one for the customer, one for quantity and one for unit of measure.  The unit of measure can be either tons, gaylords, or gallons.  I am trying to add a new column where everything is converted to tons using some sort of math function.  So I need the expression to look at the unit of measure in each row, and apply a conversion factor to change it to tons (and rows that are already reported as tons would stay the same).  Any ideas on this?  Thanks much

  • jwint,

     

    Try this calculated column. Add the correct conversion factor for Gaylords and Gallons.

     

    Quantity in Tons =
    SWITCH (
        Table1[Unit of Measure],
        "Gaylords", Table1[Quantity] * <Gaylord conversion factor>,
        "Gallons", Table1[Quantity] * <Gallon conversion factor>,
        Table1[Quantity]
    )

     

2 Replies

  • jwint,

     

    Try this calculated column. Add the correct conversion factor for Gaylords and Gallons.

     

    Quantity in Tons =
    SWITCH (
        Table1[Unit of Measure],
        "Gaylords", Table1[Quantity] * <Gaylord conversion factor>,
        "Gallons", Table1[Quantity] * <Gallon conversion factor>,
        Table1[Quantity]
    )