cancel
Showing results for
Did you mean:
Helper I

## product between measure and column

Hi everyone,

my issue is that i have to create a measure that is a result of a product between another measure and a value of a column.

table 1: "Products"

 Cod Description Cost XXXX1 Descr XXXX1 0.3 XXXX2 Descr XXXX2 1.79

Than i have my measure : Quantity

``Quantity = CALCULATE(SUM(Sales[YY. Quantity]))``

Now i have to show che Total Cost of each product where: Total Coast = Quantity x Cost

I tried with this measure:

``````Total Cost =
CALCULATE(
SUM('Table 1'[Cost])*[Quantity]
)``````

in each row of the table the result is correct. The issue is for the total:

the measure moltiply the sum of the quantity with the sum of the costs.

 Cod Quantity Cost Total Cost XXXX1 100 0.3 30 XXXX2 50 1.79 89.5 Total 150 2.09 313.5

he does 150 * 2.09.

but the right total is 30+89.5 = 119.5

Someone could help me to solve my problem?

thanks

GM

1 ACCEPTED SOLUTION
Community Champion

Use SUMX()

``````Total Cost =
SUMX( Sales, Sales[YY. Quantity] * RELATED( 'Table 1'[Cost] ) )``````
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.

2 REPLIES 2
Community Support

Hi @nannimora ,

You can refer to @Mariusz 's answer:

``````//the [Quantity] column is original data, which is not from DAX.
Measure 4 =
SUMX(
Sales,
Sales[Quantity] * RELATED('Product'[Cost])
)``````

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Champion

Use SUMX()

``````Total Cost =
SUMX( Sales, Sales[YY. Quantity] * RELATED( 'Table 1'[Cost] ) )``````
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

#### Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors