# Calculate not working right

Hi All - This should be a simple answer but I’m struggling for some reason. Please find attached pbix file. I’m trying to create a measure that subtracts 10 from sales for Target Customers.
Sample.pbix (41.9 KB)

Here’s my measure:
Target\$ = CALCULATE(SUM(Sales[Sales])-10, Customer[Target Customer]=“Yes”)

However when I put this measure besides my customers, it shows Sales-10 for all customers. It also repeats Yes and No for each customer.

The right answer for the Target\$ should just be A, B and C show (sales -10) and other customers should not show any values. Could someone help?

There’s definitely more to this one than meets the eye initially.

This measure gets the correct values by row, but not the correct total:

``````Target =
IF( SELECTEDVALUE(Customer[Target Customer]) = "Yes",
[Total Sales Minus 10],
BLANK()
)
``````

To get the correct total requires a bit more complexity:

``````Target\$ =

VAR vTable =
SUMMARIZE(
Customer,
Customer[Customer],
Customer[Target Customer]
),
"TotSales", [Total Sales],
"Targ",[Target]
)

RETURN
IF(
HASONEVALUE( Customer[Target Customer] ),
[Target],
SUMX(
vTable,
[Targ]
)
)
``````

Hope this is helpful. Full solution file attached below.

Hi @avalon.ds, we’ve noticed that no response has been received from you since the 24th of March. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the checkbox. Thanks!

A response on this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Thanks!"