Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
SL_1983
Helper II
Helper II

drilldown

Good morning,

I have a question.

I want to create 2 drilldwon tables:

In the left  table I want the following details: Product Omschrijving, Verpakking Omschrijving, Hoeveelheid. Then I want to able to drilldown using the measures Goedkoopste Prijs Per Persoon and Duurste Prijs Per Persoon.

 

In the right table I want the following details:  Product Omschrijving, Verpakking Omschrijving, Hoeveelheid. Then I want to able to drilldown using the measures Kostprijs Per Aangekochte Verpakking Hoogste Prijs and 

Kostprijs Per Aangekochte Verpakking Laagste Prijs.
 
 
I've added the 2 tables to page 2. However, I cannot add Verpakking Omschrijving, because then it gives me all the items. I only want the items of the recipes. 
 
Secondly: I want to calculate the number of packages that need to be bought to make the recipe,according to number of people in the recipe.
I've created this measure: 
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, sometimes 3, 4 or more packages need to be bought. Which formula could I use to calculate the number of packages needed? 
Now I used "2" as a parameter. But sometimes it is 3 or 4.
 
Kind regards and thank you.
 

 

1 ACCEPTED SOLUTION

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] )
 
)
)

View solution in original post

7 REPLIES 7
v-zhenbw-msft
Community Support
Community Support

Hi @SL_1983,

 

Sorry for that but we cannot understand your issue clearly , Could you please try to verify if the following measure can output the desire result you want?

 

Test = 
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,
                ROUND (
                    DIVIDE (
                        'Ingrediënten'[Hoeveelheid],
                        'Ingrediënten'[Verpakking Gewicht Goedkoopste Prijs]
                    )
                        * RELATED ( 'Product'[Goedkoopste Prijs] ),
                    0
                )
            )
    )
)

 

The result like this,

 

drill1.jpg

 

If it doesn’t meet your requirement, could you please provide the desire result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,


Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

no the input is using that measure is not correct.

 

I've created an excel sheeft based on Verpakking Hoogste Prijs. It includes the results that the meausure "Kostprijs Per aangekochte Verpakking Hoogste Prijs" should produce.

 

Link to the excel file: https://1drv.ms/x/s!AuaqHTxLCZ_h1jpRcr4IUX53wYDK?e=oocKku

 

 

Hello @MFelix ,

 

I've tried it using the below 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]; ROUND (
DIVIDE (
(('Ingrediënten'[Hoeveelheid]/4)*SELECTEDVALUE('Slicer Aantal Personen'[Aantal Personen]));
'Ingrediënten'[Verpakking Gewicht Goedkoopste Prijs]
);0)
* RELATED ( 'Product'[Goedkoopste Prijs] )
)
)
))
 
But the result is not correct. 
 
The calculation for the number of packages should be as follows: 
Example:  slicer 1 pax:
if 'Ingrediënten'[hoeveelheid] <= 'Ingrediënten'[Verpakking Gewicht Duurste Prijs];1;(('Ingrediënten'[hoeveelheid]/4)/'Ingrediënten'[Verpakking Gewicht Duurste Prijs]).
 
If the result of the number of packages is 1.5, it should be rounded up to two.
 
Link to the excel sheet for the calculation: https://1drv.ms/x/s!AuaqHTxLCZ_h1jpRcr4IUX53wYDK?e=ygvAw6
 
Can someone assist me?
 

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] )
 
)
)
SL_1983
Helper II
Helper II

Hello,

I've tried adding the following column to the table 'Ingrediënten' :

Lijst = 

CALCULATE(
SELECTEDVALUE('Verpakking'[Verpakking_Omschrijving]);
filter('Verpakking Winkel';'Verpakking Winkel'[Product Id]='Ingrediënten'[Product Id] &&
'Verpakking Winkel'[Verpakking Id] = RELATED(Verpakking[Verpakking_ID])))
 
But it only returns some of the package descriptions....
 

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.

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....

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.