PRODUCTX DAX Function in Power BI

The PRODUCTX is a DAX function in Power BI that calculates the product of an expression evaluated row by row in a specified table.

DAX Syntax PRODUCTX(table, expression)

The function has the following parameters:

How the function works: Step 1: Iterates row by row over a given table.
Step 2: Evaluates the <expression> for each row.
Step 3: Multiplies all values returned by the expression.

Example: Let’s create a calculated column.

DAX

PRODUCTX Column =
PRODUCTX (
    Query38,
    IF ( Query38[Company] = "TCS", Query38[CustomerID] * 2, Query38[CustomerID] )
) 

The output of the above code is shown below:

PRODUCTX dax function in Power BI

Here the values are calculated in such a way that:
• For each row in Query38, the formula checks if the value in the Company column is "TCS".
• If true, it multiplies CustomerID by 2.
• If false, it keeps CustomerID as it is.

Let’s see the evaluated result:

CustomerIDNameCompanyEvaluation (Expression Result)
1AshishTCS1 * 2 = 2
2KatrinaMicrosoft2
3AliaGoogle3
4VickyAccenture4
5MohiniInfosys5
6MeenakshiTCS6 * 2 = 12
7EshaTCS7 * 2 = 14
8AnjaliGoogle8

Now, PRODUCTX will multiply all these evaluated values:

2 * 2 * 3 * 4 * 5 * 12 * 14 * 8 = 322560