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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
emilmaican
Frequent Visitor

How to calculate amount on each item based on its share

Hi,

 

I have a situation and I can't figure out how to solve it. I hope you can help me.

 

My model looks like this:

emilmaican_0-1609928760648.png

 

Table PRODUCTS sample (there are duplicated values on column ProductId):

- each product has a total production cost (on column Total cost)

 

emilmaican_1-1609927550384.png

 

 

Table RAWMATERIALSHARE sample (there are also duplicated values on column ProductId):

Each ProductId is made out of several RawMaterials. The split of cost for a certain ProductId by each RawMaterialId is shown on column "RawMaterialShare": 

emilmaican_2-1609927579002.png

 

I need to build a graph/chart showing the cost of each RawMaterialId by year

The result should be this:

Values201820192020Grand Total
Gold20005103702880
Silver24506304403520
Platinum12503802301860
Copper3008060440
    8700

 

Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@emilmaican, try a new measure as

sumx(Summarize(RAWMATERIALSHARE, RAWMATERIALSHARE [productid], RAWMATERIALSHARE[rawmaterialid], "_1", sum(PRODUCTS[TotalCost]) * sum(RAWMATERIALSHARE[rawmaterialshare)]),[_1])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@emilmaican, try a new measure as

sumx(Summarize(RAWMATERIALSHARE, RAWMATERIALSHARE [productid], RAWMATERIALSHARE[rawmaterialid], "_1", sum(PRODUCTS[TotalCost]) * sum(RAWMATERIALSHARE[rawmaterialshare)]),[_1])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for the quick answer. I understood the principle. It seems there is something missing in your formula and I'm trying to solve it.

I found the solution.  Thank you:

 

 

CostByRawMaterial =
SUMX (
SUMMARIZE (
RAWMATERIALSHARE,
RAWMATERIALSHARE[productid],
RAWMATERIALSHARE[rawmaterialid],
"_1", SUM ( PRODUCTS[TotalCost] ) * SUM ( RawMaterialShare[RawMaterialShare] )
),
[_1]
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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