Forum Discussion
cocoloco79
5 years agoHelper III
Parameter with condition
Hi everyone I need to add a second parameter which will kick in if (invoiced[ConsigneeName]) is "ABC" to apply a diffrenet price. Can someone assist with this? Much appreciated!!! thank you! ...
- 5 years ago
Hi cocoloco79
Based on your all inputs. Below code would required to get desired output:-
Estimated_market_price = VAR result = IF ( MAX ( Invoiced[Qty Invoiced] ) <> MAX ( Invoiced[Qty Sent] ), IF ( MAX ( Invoiced[Consignee] ) = "Kalfresh", SUM ( Invoiced[Estimated market price] ), SUM ( Invoiced[$/Unit] ) ) ) RETURN IF ( result = 0, 0, result )Output:-
Please let me know if it works for you.
Thanks,
Samarth
cocoloco79
5 years agoHelper III
Hi Samarth_18
Yes thats right, we need to tolal them both up so the the end result.
i.e kalfresh priced at $10 and the rest priced at $20... need to total all values up.
Samarth_18
5 years agoCommunity Champion
Alright, then your final code would be as below:-
Estimated_market_price =
VAR _kalfres_data =
IF (
MAX ( Invoiced[Qty Invoiced] ) <> MAX ( Invoiced[Qty Sent] ),
IF (
MAX ( Invoiced[Consignee] ) = "Kalfresh",
SUM ( Invoiced[Estimated market price] )
)
)
VAR rest_data =
IF (
MAX ( Invoiced[Qty Invoiced] ) <> MAX ( Invoiced[Qty Sent] ),
SUM ( Invoiced[$/Unit] )
)
RETURN
_kalfres_data + rest_data
Thanks,
Samarth