Forum Discussion
Parameter with condition
- 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
Hi cocoloco79 ,
Just be on the same page, could you please confirm me on below points:-
1. Our first condition would if Invoiced[Qty Invoiced] is not equal to Invoiced[Qty Sent] and Invoiced[Market] is equal to "Kalfresh" then this condition should kicks in
"SELECTEDVALUE('Estimated Market Price Kalfresh'[Estimated Market Price Kalfresh])*SUM(Invoiced[Not Invoiced Qty]),"
2. Our next condition would if Invoiced[Qty Invoiced] is not equal to Invoiced[Qty Sent] and Invoiced[Market] is not equal to "Kalfresh" then this condition should kicks in
"SELECTEDVALUE('Market Price/ unit'[Parameter])*SUM(Invoiced[Not Invoiced Qty])"
Please correct me if i am wrong.
And also kindly share what output you are currently getting and what would be expected.
In the meantime you can try with replace last two line with below code
RETURN result
Thanks,
Samarth
Hi Samarth_18
Yes, we are on the same page.
Can both calulation be run at the same time if those 2 conditions are met?
I have applied the two lines "Return result" but that didnt return the right resluts.
Thank you!
| Consignee | OuterProduct | Pieces | Qty Sent | Qty Invoiced | Weight | $/Unit | Gross Invoiced | Buyer Rebate | Freight | Packing | Marketing | Estimated_market_price | Estimated market price x 10 % | Estimated market price minus Estimated market price x 10 % | Marketing Discount Amount | Grower Return plus Estimated market price plus discount minus ETM 10% | Grower Return plus Estimated market price plus discount divided by Weight | Grower Return plus Estimated market price plus discount minus ETM 10% divided by Pieces |
| Kalfresh | CLCR - Organic Green Bean - Loose - 10kg Crate | 0 | 5149 | 4077 | 51490 | $41.79 | $170,385.10 | $0.00 | $8,513.87 | ######## | ######## | $0.00 | $0.00 | $0.00 | $0.00 | $4,007.57 | $0.08 | |
| A | PFST - Passionate Farmer - Organic - Green Beans - 10kg Styro | 0 | 468 | 256 | 4680 | $42.27 | $10,820.00 | $0.00 | $1,805.51 | ######## | $1,082.00 | $0.00 | $0.00 | $0.00 | $0.00 | ######## | -$1.17 | |
| B | PFCTN - Passionate Farmer - Organic - Green Beans - 10kg Carton | 0 | 262 | 190 | 2620 | $40.00 | $7,600.00 | $0.00 | $320.25 | $7,493.20 | $760.00 | $0.00 | $0.00 | $0.00 | $0.00 | -$973.45 | -$0.37 | |
| C | PFCTN - Passionate Farmer - Organic - Green Beans - 10kg Carton | 0 | 246 | 222 | 2460 | $45.00 | $9,990.00 | $0.00 | $117.99 | $7,035.60 | $999.00 | $0.00 | $0.00 | $0.00 | $0.00 | $1,837.41 | $0.75 | |
| D | PFST - Passionate Farmer - Organic - Green Beans - 10kg Styro | 0 | 24 | 0 | 240 | $0.00 | $0.00 | $0.00 | $686.40 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | -$686.40 | -$2.86 | ||
| E | PFCTN - Passionate Farmer - Organic - Green Beans - 10kg Carton | 0 | 16 | 16 | 160 | $60.00 | $960.00 | $0.00 | $84.67 | $457.60 | $96.00 | $0.00 | $0.00 | $0.00 | $0.00 | $321.73 | $2.01 |
- Samarth_185 years agoCommunity Champion
If both calculation will run then we need to sum both the output?
- cocoloco795 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_185 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_dataThanks,
Samarth