Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
| Account Name | Date | Amount |
| Rev | 12-Jun-18 | 430 |
| Exp | 13-Aug-17 | 250 |
| Margin | 2-Mar-17 | 0 |
| Rev | 12 July 18 | 400 |
| Exp | 13-Aug-17 | 300 |
I have a table where I need to create a calculated measure based on the below logic
If the Account Name <> 'Margin' then Sum of amount
if the Account Name = "Margin' then Sum of amount =
Sum of Amount when account name is 'Rev' - Sum of Amount when account name is 'Exp'
try this
Measure =
IF (
SELECTEDVALUE ( 'Table'[Account Name] ) = "Margin",
CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Account Name] = "Rev" )
- CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Account Name] = "Exp" ),
SUM ( 'Table'[Amount] )
)if you have more cases like this it may be better to embed the logic in a new table, e.g. like this:
| Measure | Positive | Negative |
| Margin | Rev | Exp |
| Margin2 | Rev | Exp2 |
something similar to what's described here:
https://community.powerbi.com/t5/Desktop/Create-calculated-row/td-p/440613
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 17 | |
| 16 | |
| 12 | |
| 8 | |
| 5 |