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 ,
Sample data link is not working for me. Could you please paste some sample data here if it is not sensitive and also what is the output you are getting with expected output data. Measure code looks fine to me I can check if you could provide above required details.
Thanks,
Samarth
Hi Samarth_18
desired output would be that if market is "Kalfresh" the estimated market price is ignored and instead Estimated Market Price Kalfresh' is used. So in a nutshell, A,B,C will look at the Market Price/ unit' and Kalfresh will look at Estimated Market Price Kalfresh' IF there is a difference in Qty invoiced.
| 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 | 1072 | 0 | 10720 | $0.00 | $0.00 | $917.60 | $29,319.20 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | ######## | -$2.82 | ||
| A | PFST - Passionate Farmer - Organic - Green Beans - 10kg Styro | 0 | 108 | 60 | 1080 | $45.00 | $2,700.00 | $0.00 | $258.00 | $3,088.80 | $270.00 | $0.00 | $0.00 | $0.00 | $0.00 | -$916.80 | -$0.85 | |
| B | PFCTN - Passionate Farmer - Organic - Green Beans - 10kg Carton | 0 | 54 | 54 | 540 | $45.00 | $2,430.00 | $0.00 | $0.00 | $1,544.40 | $243.00 | $0.00 | $0.00 | $0.00 | $0.00 | $642.60 | $1.19 | |
| C | PFCTN - Passionate Farmer - Organic - Green Beans - 10kg Carton | 0 | 36 | 0 | 360 | $0.00 | $0.00 | $0.00 | $1,029.60 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | ######## | -$2.86 |
- Samarth_185 years agoCommunity Champion
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
- cocoloco795 years agoHelper III
Thank you very much, this worked!!!!!