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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
D3K
Advocate II
Advocate II

Summary Totals of subcategory

Hello everyone!

 

Hope to find here the solution for my problem. Will appreciate any help

 

Here is the question. I've got 3 tables:
- sales

- product list

- ingredients

 

Each product consist of some ingredients with definite quantity of it in the product. And I can't write a measure or create support table so to be able to see the summary sales (quantity and weight) of each ingredient on any date and in any store. 

Summary ingredient sales = Parent product sales (quantity) * Quantity of ingredient in this product * Weight of ingredient

 

Скриншот 2018-10-01 20.55.38.png

 

 

I've tried to solve it via creating support table and got the summary ingredient sales, but it doesn't react for slicers "Date" and "Store".  Or via measure - it reacts for slicer, but shows summary parent products sales for any of it's ingredient.

 

Will appreciate very much if would get help here

Thanks!

1 ACCEPTED SOLUTION

Hi @D3K,

 

Please do some changes.

 

1. Change the Relationship like below.

 

Untitled.png

 

2. Change your measure Sales, qnt like this = CALCULATE(MAX('August Sales'[Qnt]))

 

3. Change the measure totalweight of ingredient = [totalpiece of ingredient]*CALCULATE(MAX('Ingredients'[Weight,gr]))

 

result2.PNG

 

More details, please refer to the pbix.

 

Best Regards,

Cherry

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

View solution in original post

11 REPLIES 11
D3K
Advocate II
Advocate II

@v-piga-msft

 

And also pls check this. If there is no filter chosen - values in the result table are also not correct, it's to high: only 33 burgers are sold and 378 pieces of bread are used for it (the same and with the weight). 

Screenshot3.png

 

 

As you can see it was not easy Smiley Happy

Hi @D3K,

 

Please do some changes.

 

1. Change the Relationship like below.

 

Untitled.png

 

2. Change your measure Sales, qnt like this = CALCULATE(MAX('August Sales'[Qnt]))

 

3. Change the measure totalweight of ingredient = [totalpiece of ingredient]*CALCULATE(MAX('Ingredients'[Weight,gr]))

 

result2.PNG

 

More details, please refer to the pbix.

 

Best Regards,

Cherry

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

@v-piga-msft

 

Done! I've just changed MAX to SUM in "Sales,qnt" calculation. And SUMX in totalpiece calculations. And it started to work perfectly.

 

Cherry, thank you very much!!

Hi @D3K

 

Your're welcome!Smiley Very Happy It's glad that we can help!

 

Best Regards,

Cherry

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

@v-piga-msft

 

Thank you very much, it works almost correctly! 

 

But Smiley Happy as you can see on the screenshot below, when you choose any burger, which has more than 1 sale, in the result table it counts ingredients for only one dish anyway. But at the same time it shows correct total weight (marked green on the picture).

Screenshot4.png

 

 

 

 

D3K
Advocate II
Advocate II

Hi @D3K,

 

Do you want to get the output like below?

result.PNG

 

 

If it is, you should change the relationship like below Firstly.

Both.PNG

 

Then you could create two measures with the formula below.

 

totalpiece of ingredient = CALCULATE(SUM(Ingredients[Quant-in-product]))*[Sales, qnt]

totalweight of ingredient = [totalpiece of ingredient]*CALCULATE(SUM('Ingredients'[Weight,gr]))

More details, please refer to the attachment.

 

If you still need help, please share your desired output.

 

Best Regards,

Cherry

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

@v-piga-msft

Cherry, thank a lot!! 

At first, it started to count correctly only needed ingredients for dishes! Smiley Happy

 

But, as you can see on the screenshot below, if you need to choose a date/store it starts to show some wrong values in the result table. It's seemed like it makes extra totals: only needed ingredients, but all values from sales table. Please, help to find, where is the mistake?

Thanks again!

Screenshot2.png

 

 

 

v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @D3K,

 

What is the parent product sales(quantity)?

 

If it is convenient, could you share your data as table so that I can copy and have tests. 

 

In addition, I would appreciate it if you could share your desired output so that we could help further on it.

 

Best Regards,

Cherry

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

Hi again, @v-piga-msft!

 

Here is the sample of structure of my report.

 

https://app.powerbi.com/view?r=eyJrIjoiMTVjZDI1YTQtNDI2Yi00NDdjLWFiNDUtMGQ0MGU2NDM2MzBkIiwidCI6ImQwO...

 

As you can see, we have some quantity of burgers during the month in different stores. Each burger consist of some ingredients.  And we need to get total sales of ingredients also related to the date and store.

 

For example, Burger 1 contains 2 pieces of tomato 20 gr each. We sold 3 burgers. So 3 (burgers) * 2 (pieces of tomato) * 20 (weight of piece of tomato) = 120 gr and 6 pieces. And data in final table on report sheet is "Tomato / 120 / 6".

 

In the red circle is needed view of final table: total sales of each ingredient

Screenshot.png

 

 

 

 Thank you!

Hi, @v-piga-msft!

 

Thanks! Yes, give me 20 minutes, pls. I'll translate nedded data and share.

 

Parent product - I meant, for example, Product 1 consists of tomato, chiken and cheese, and for theese ingredients Product 1 is Parent

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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