Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
120 | |
74 | |
72 | |
58 | |
50 |
User | Count |
---|---|
167 | |
83 | |
68 | |
66 | |
55 |