Forum Discussion
drilldown
- 6 years ago
I found the solution:
sumx('Ingrediënten';('Ingrediënten'[Verpakking Gewicht Duurste Prijs]* if (('Ingrediënten'[Hoeveelheid]/4)* SELECTEDVALUE('Slicer Aantal Personen'[Aantal Personen]) > 'Ingrediënten'[Verpakking Gewicht Duurste Prijs];( ROUNDUP (DIVIDE ((('Ingrediënten'[Hoeveelheid]/4)*SELECTEDVALUE('Slicer Aantal Personen'[Aantal Personen]));'Ingrediënten'[Verpakking Gewicht Duurste Prijs]);0));1)* RELATED ( 'Product'[Duurste Prijs] )))
Hello,
I've tried adding the following column to the table 'Ingrediënten' :
Lijst =
Hello,
I solved most of it, except, the calculation of the number of packages needed.
This the measure I created:
Kostprijs per aangekochte verpakking Hoogste Prijs = SUMX('Ingrediënten';('Ingrediënten'[Verpakking Gewicht Duurste Prijs] * IF(('Ingrediënten'[Hoeveelheid]/4) * SELECTEDVALUE('Slicer Aantal Personen'[Aantal Personen])<='Ingrediënten'[Verpakking Gewicht Duurste Prijs];1;2)) * related('Product'[Duurste Prijs]))
However, in this calculation it says, that I need or 1 or 2 packages, but sometimes I need 3 or 4 packaged. The number of packages needed depends on the number op people in the recipe.
If Verpakking Gewicht Duurste Prijs is smaller than the 'Hoeveelheid' needed it should follow the following calculation; (Ingrediënten[Hoeveelheid/'Slicer aantal Personen'[Aantal Personen])/Ingredienten[Verpakking Gewicht Duurste Prijs]. (However I am not sure that this is the correct calculation.
Also it is important that this number is rounded up (no decimals) But I can't figure out how I can get this calculation in the measure above.
- SL_19836 years agoHelper II
I've tried fixing it using this measure:
SUMX('Ingrediënten';('Ingrediënten'[Verpakking Gewicht Goedkoopste Prijs] * IF(('Ingrediënten'[Hoeveelheid]/4)* SELECTEDVALUE('Slicer Aantal Personen'[Aantal Personen])<='Ingrediënten'[Verpakking Gewicht Goedkoopste Prijs];1;if((('Ingrediënten'[Hoeveelheid]/4)* SELECTEDVALUE('Slicer Aantal Personen'[Aantal Personen]))>'Ingrediënten'[Verpakking Gewicht Goedkoopste Prijs];roundup(divide(('Ingrediënten'[Hoeveelheid]);'Ingrediënten'[Verpakking Gewicht Goedkoopste Prijs]);0)* related('Product'[Goedkoopste Prijs])))))However, something the result is not correct....