Power Query Value.Multiply: How to Use It
In this article
Value.Multiply is a Power Query M function that returns the product of two numbers, and you use it by writing Value.Multiply(number1, number2) in a custom column or a query step. It is the simplest way to multiply values inside Power Query when you need more control than the built-in multiply operator or when you are generating a column of products programmatically. Before you start, you need Power Query available in your host application (Excel, Power BI, or another tool that embeds it) and a query that already loads the table or list you want to work with.
What You'll Need
- A version of Excel, Power BI Desktop, or another application that includes the Power Query Editor. The exact menu labels can differ slightly by version, device, or region.
- A query that returns a table containing at least one numeric column.
- Basic familiarity with the Power Query Editor, including the formula bar and the Advanced Editor.
Step-by-Step
- Open the Power Query Editor. In Excel, select a cell inside your data and go to Data > From Table/Range. In Power BI Desktop, use Home > Transform data. This opens the Power Query Editor window.
- Confirm the column is numeric. Select the column header you want to multiply. The status bar at the bottom shows the detected data type. If it says Text or Any, use Transform > Data Type > Decimal Number (or Whole Number) to convert it. Value.Multiply returns an error if either argument is not a number.
- Add a custom column. Go to Add Column > Custom Column. Give the new column a name, such as "Extended Price".
- Write the Value.Multiply formula. In the formula box, enter a formula that references your columns, for example
Value.Multiply([Quantity], [UnitPrice]). Column names are case-sensitive and must be enclosed in square brackets. If a column name contains spaces, keep the brackets as-is. - Check the result. Select OK. Power Query adds the new column and shows the product for each row. If you see
Errorin a cell, hover over it to read the message; the most common cause is a null or text value in one of the source columns. - Adjust the data type of the new column. Right-click the new column header and choose Change Type > Decimal Number if Power Query has not already inferred it.
- Use Value.Multiply in the Advanced Editor if you need a list or a single value. For example, to multiply every number in a list, you can use
List.Product({1, 2, 3, 4}), which is the list-level equivalent. For a one-off calculation, you can also writeValue.Multiply(12, 8)in a blank query to return 96. - Apply and close. When the column looks correct, select Home > Close & Load (Excel) or Home > Close & Apply (Power BI) to load the result back into your workbook or model.
Common Mistakes
- Passing text instead of numbers. Value.Multiply expects numeric arguments. If a column contains numbers stored as text, convert the data type first. A leading apostrophe or a thousands separator can keep a value as text.
- Forgetting square brackets around column names. In a custom column formula, column references must be written as
[ColumnName]. WritingQuantitywithout brackets causes a syntax error. - Using the wrong case. M is case-sensitive.
[quantity]and[Quantity]are different references, and the wrong one returns an error. - Multiplying a column by itself by accident. If you reference the same column twice, you get the square of each value, not the product of two different columns.
- Ignoring nulls. A null in either argument makes the result null. Decide whether to replace nulls with zero or filter them out before multiplying.
- Expecting Value.Multiply to work on lists. It takes two numbers. For a list of numbers, use List.Product instead.
Tips
- Use the formula bar to inspect the generated step. Power Query writes the M code for you, which is a quick way to learn the syntax.
- Name your custom column clearly, such as "LineTotal", so downstream steps and reports are easier to read.
- If you need to multiply by a fixed number, you can put the number directly in the formula, for example
Value.Multiply([Price], 1.2)to add a 20 percent markup. - For simple column-by-column multiplication, the
*operator works too, for example[Quantity] * [UnitPrice]. Value.Multiply is most useful when you want a named function call or when you are building formulas dynamically. - Test on a small query first. A custom column applies to every row, so a type error can affect the whole table.
Troubleshooting
- The custom column shows Error for every row. Check the data types of both source columns. Convert them to Decimal Number or Whole Number, then refresh the query.
- The formula will not save. Look for a missing bracket, a misspelled column name, or a comma in the wrong place. The formula box highlights syntax problems as you type.
- Only some rows show Error. Those rows likely contain nulls or text. Use Home > Replace Values to handle nulls, or filter the column to keep only numeric values.
- The result is rounded unexpectedly. Change the column type to Decimal Number instead of Whole Number, and check the source column types as well.
- The column disappears after refresh. If the source table no longer has the referenced column, the step fails. Re-check the source or update the formula to match the current column names.
- You need a total product, not a row-by-row product. Use List.Product on a list of the column values, or add a step that references the column as a list.
Frequently Asked Questions
What does Value.Multiply do in Power Query?
It returns the product of two numbers. It is the M function equivalent of multiplying two values and is most often used inside a custom column formula.
Can I multiply more than two numbers at once?
Value.Multiply takes exactly two arguments. To multiply three or more values, nest the calls, for example Value.Multiply(Value.Multiply([A], [B]), [C]), or use the * operator in a single formula.
Why does Value.Multiply return null?
If either argument is null, the result is null. Replace nulls with a number or filter those rows out before multiplying.
What is the difference between Value.Multiply and List.Product?
Value.Multiply works on two individual numbers. List.Product takes a list of numbers and returns their combined product, which is useful for aggregating a whole column.
Does Value.Multiply work with text that looks like a number?
No. The arguments must be numeric. Convert the column to a number data type first, or use Number.From to convert a single value.
Can I use Value.Multiply in a calculated column in Power BI?
Value.Multiply is an M function used in Power Query, not a DAX function. In a DAX calculated column, use the * operator instead.