cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
ahadtk
Frequent Visitor

Raw materials and their product prices over the time

Dear All!

We have an Excel table like below:

 PricePricePricePricePricePricePricePricePricePricePricePricePricePricePrice
 01-01-202202-01-202203-01-202204-01-202205-01-202206-01-202207-01-202208-01-202209-01-202210-01-202211-01-202212-01-202213-01-202214-01-202215-01-2022
Raw Material 15.644.222.259.88.184.545.867.22.636.651.064.492.225.057.54
Raw Material 23.596.827.612.066.624.353.042.787.636.311.516.057.272.973.61
Raw Material 35.954.025.931.335.131.176.41.049.947.873.911.824.159.515.1
Raw Material 44.91.585.231.044.893.269.764.717.745.14.361.22.333.549.26
Raw Material 58.651.558.717.395.858.326.698.525.778.438.863.28.433.153.87
Raw Material 68.718.23.164.798.022.471.883.419.652.533.227.63.22.24.56
Raw Material 76.892.24.867.16.196.849.915.296.863.272.188.674.31.052.64
Raw Material 83.728.788.351.26.438.424.116.51.358.043.411.562.328.385.03
Raw Material 95.074.016.348.72.365.837.633.975.114.985.711.399.316.573.72
Raw Material 107.044.269.554.644.168.135.094.32.728.139.6663.357.354.53
Raw Material 115.985.528.21.513.234.851.517.288.743.516.969.57.32.983.37
Raw Material 123.458.716.493.733.291.421.238.362.927.791.991.231.032.448.8
Raw Material 132.767.226.939.897.069.165.81.492.965.495.478.367.171.155.21
Raw Material 148.685.387.188.146.119.851.521.51.987.347.913.852.674.042.9
Raw Material 1598.894.44.393.128.043.269.548.353.835.691.642.75.954.96
Raw Material 1666.292.251.756.699.088.871.238.779.738.314.87.851.526.49
Raw Material 171.735.029.784.679.813.385.747.358.534.123.263.329.235.246.69
Raw Material 188.053.27.247.614.969.419.954.355.667.835.133.111.863.288.46
Raw Material 199.432.121.889.716.777.583.973.458.362.582.812.496.513.541.54
Raw Material 209.013.135.467.021.566.053.775.635.021.21.544.67.015.654.43

 

And another excel table like below:

Product 1=Raw Material 18+Raw Material 19+Raw Material 15      
Product 2=Raw Material 17+Raw Material 5+Raw Material 1+Raw Material 16    
Product 3=Raw Material 8+Raw Material 2+Raw Material 16+Raw Material 17+Raw Material 19  
Product 4=Raw Material 8+Raw Material 15+Raw Material 9+Raw Material 17+Raw Material 14+Raw Material 2
Product 5=Raw Material 2+Raw Material 14+Raw Material 8      
Product 6=Raw Material 15+Raw Material 19+Raw Material 18+Raw Material 16+Raw Material 3  
Product 7=Raw Material 16+Raw Material 11+Raw Material 9+Raw Material 5    
Product 8=Raw Material 6+Raw Material 7        
Product 9=Raw Material 11+Raw Material 13+Raw Material 7+Raw Material 14    
Product 10=Raw Material 20+Raw Material 5+Raw Material 1      

 

We need to track the prices over time for raw materials and also the product,

I know that it is not hard to track the raw materials over time,

But, since we have thousands of products and thousands of raw materials and hundreds of prices back in time, it is hard to:

combine the prices of raw materials for a specific product and track its price over the time,

It would be great if you help me,

Thanks,

 

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @ahadtk ,

You may consider transposing the tables in the Power Query Editor, like:

Table1:

vcgaomsft_0-1668575456027.png

Table2:

vcgaomsft_1-1668575487747.png

Then create a new measure:

Measure = 
VAR _PRODUCT = MAX('Table 2'[Product])
VAR _DATE = MAX('Table 1'[Date])
VAR _MATERIALS = CALCULATETABLE(VALUES('Table 2'[Raw materials]),FILTER(ALL('Table 2'),'Table 2'[Product]=_PRODUCT))
VAR _PRICE = CALCULATE(SUM('Table 1'[Price]),'Table 1'[Date]=_DATE&&'Table 1'[Raw materials] IN _MATERIALS)
RETURN
_PRICE

Result:

vcgaomsft_2-1668575564248.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
ahadtk
Frequent Visitor

Hi @v-cgao-msft 

Thanks a lot 🙂

v-cgao-msft
Community Support
Community Support

Hi @ahadtk ,

You may consider transposing the tables in the Power Query Editor, like:

Table1:

vcgaomsft_0-1668575456027.png

Table2:

vcgaomsft_1-1668575487747.png

Then create a new measure:

Measure = 
VAR _PRODUCT = MAX('Table 2'[Product])
VAR _DATE = MAX('Table 1'[Date])
VAR _MATERIALS = CALCULATETABLE(VALUES('Table 2'[Raw materials]),FILTER(ALL('Table 2'),'Table 2'[Product]=_PRODUCT))
VAR _PRICE = CALCULATE(SUM('Table 1'[Price]),'Table 1'[Date]=_DATE&&'Table 1'[Raw materials] IN _MATERIALS)
RETURN
_PRICE

Result:

vcgaomsft_2-1668575564248.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors