Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi!
I have a table like below and I want to subtract 40% from the quantity of the pears and add 10% to the quantity of the apples.
| Fruit Type | Quantity |
| Pears | 20 |
| Cherries | 10 |
| Bananas | 40 |
| Apples | 15 |
| Summary | 85 |
It's just an egxample - in fact i must do it with sessions for source / medium from Google Analytics but but I figured it would be easier to explain. Coming back to the fruit example, I wrote the following calculation:
Solved! Go to Solution.
@jkoclejda try this for a quick fix to your formula:
Fruit Quantity =
VAR _Pears = CALCULATE((SUM('Fruits'[Quantity]) * 0.4), KEEPFILTERS('Fruits'[Fruit Type] = "Pears"))
VAR _Apples = CALCULATE((SUM('Fruits'[Quantity]) * 0.1), KEEPFILTERS('Fruits'[Fruit Type] = "Apples"))
RETURN
CALCULATE(
SUM('Fruits'[Quantity]) - _Pears +_Apples
)
@jkoclejda try this for a quick fix to your formula:
Fruit Quantity =
VAR _Pears = CALCULATE((SUM('Fruits'[Quantity]) * 0.4), KEEPFILTERS('Fruits'[Fruit Type] = "Pears"))
VAR _Apples = CALCULATE((SUM('Fruits'[Quantity]) * 0.1), KEEPFILTERS('Fruits'[Fruit Type] = "Apples"))
RETURN
CALCULATE(
SUM('Fruits'[Quantity]) - _Pears +_Apples
)
It works perfect! Thank you very much 🙂
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |