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!
I have 2 tables Payment and Sales.
The Payment table has Payment and Write-Off columns that I want to add to the Sales table.
Now the issue is the amounts could be either positive or negative.
Relationship is Payment(many) ---> Sales (one)
So I know I have to use the relatedtable. I added the field to the Sales table using the following:
maxx(RELATEDTABLE(Payment), Payment[Write-Off Amount])
But now I am not sure how to change the code so that ifthe Write-Off amount is positive instead of grabbing the max, the code will grab the min and when it is positive it will grab the max? Is this even possible in Power BI?
Solved! Go to Solution.
Measure =
VAR _sum = SUM(Payment[Write-Off Amount]))
VAR _maxx = MAXX(RELATEDTABLE(Payment),Payment[Write-Off Amount])
VAR _minx = MINX(RELATEDTABLE(Payment),Payment[Write-Off Amount])
RETURN IF(_sum<0,_minx,_maxx)
@newkingdom can you try the above?
Measure =
VAR _sum = SUM(Payment[Write-Off Amount]))
VAR _maxx = MAXX(RELATEDTABLE(Payment),Payment[Write-Off Amount])
VAR _minx = MINX(RELATEDTABLE(Payment),Payment[Write-Off Amount])
RETURN IF(_sum<0,_minx,_maxx)
@newkingdom can you try the above?
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 |
|---|---|
| 64 | |
| 53 | |
| 42 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 122 | |
| 104 | |
| 45 | |
| 31 | |
| 24 |