The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I would like to know how cn I add a column im my report to show an ID have same positive and negative data
I have a line table and it includes all salesorder data and a salesorder can include sales and return data in a same time sale amount is positive and returns is negative I need to add a column in my report to show if salesorder include return and sales show "yes" otherwise "NO"
TransactionId | ProductId | InfoCode | NetAmount | EXCHANGE |
R11-50 | 81770 | NULL | -650 | YES |
R11-50 | 263879 | NULL | 1050 | YES |
R11-50 | 54599 | NULL | -925 | YES |
R11-50 | 237164 | NULL | 995 | YES |
R08-525 | 198879 | NULL | -275 | NO |
R08-525 | 23471 | NULL | -546 | NO |
R02-12982 | 235905 | NULL | 935 | NO |
R02-12982 | 43749 | NULL | 995 | NO |
Solved! Go to Solution.
If I understand correctly, this DAX column expression should work. Just replace Exchanges with your actual table name.
Has Pos and Neg Values =
VAR thisID = Exchange[TransactionId]
VAR haspos =
COUNTROWS (
FILTER ( Exchange, Exchange[NetAmount] > 0 && Exchange[TransactionId] = thisID )
) > 0
VAR hasneg =
COUNTROWS (
FILTER ( Exchange, Exchange[NetAmount] < 0 && Exchange[TransactionId] = thisID )
) > 0
RETURN
IF ( haspos && hasneg, "Yes", "No" )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
If I understand correctly, this DAX column expression should work. Just replace Exchanges with your actual table name.
Has Pos and Neg Values =
VAR thisID = Exchange[TransactionId]
VAR haspos =
COUNTROWS (
FILTER ( Exchange, Exchange[NetAmount] > 0 && Exchange[TransactionId] = thisID )
) > 0
VAR hasneg =
COUNTROWS (
FILTER ( Exchange, Exchange[NetAmount] < 0 && Exchange[TransactionId] = thisID )
) > 0
RETURN
IF ( haspos && hasneg, "Yes", "No" )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.