Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Solved! Go to Solution.
Hi @nannimora
Use SUMX()
Total Cost =
SUMX( Sales, Sales[YY. Quantity] * RELATED( 'Table 1'[Cost] ) )
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.
Hi @nannimora
Use SUMX()
Total Cost =
SUMX( Sales, Sales[YY. Quantity] * RELATED( 'Table 1'[Cost] ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |