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] ) )
Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.
Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!
Join the biggest FREE Business Applications Event in LATAM this February.
User | Count |
---|---|
234 | |
52 | |
48 | |
48 | |
44 |
User | Count |
---|---|
290 | |
241 | |
159 | |
85 | |
68 |