Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello community!
I have the following problem when trying to calculate a total quantity. I have a table containing a list of article codes that represent tyres or wheelsets. All have a forecasted quantity. The wheelsets consist of both a tyre and a tube. Thus, to calculate the total forecasted quantity of a tyre I need to take into account the corresponding wheelset quantities as well. Important to note is that there are tyres that exists in multiple wheelset combinations.
The aim is to sum the forecasted tyre quantity plus the wheelset quantity that contains the tyre to come to a total forecasted quantity per article code. See an example below as well.
Table 1 | ||
Article Code | Quantity | Contains Tyre |
Tyre 1 | 100 | |
Tyre 2 | 130 | |
Tyre 3 | 200 | |
Wheel 1 | 50 | Tyre 1 |
Wheel 2 | 30 | Tyre 3 |
Wheel 3 | 40 | Tyre 2 |
Wheel 4 | 40 | Tyre 1 |
Wheel 5 | 60 | Tyre 2 |
Desired Result | |||
Article Code | Quantity | Contains Tyre | Total Quantity |
Tyre 1 | 100 | 190 | |
Tyre 2 | 130 | 230 | |
Tyre 3 | 200 | 230 | |
Wheel 1 | 50 | Tyre 1 | 50 |
Wheel 2 | 30 | Tyre 3 | 30 |
Wheel 3 | 40 | Tyre 2 | 40 |
Wheel 4 | 40 | Tyre 1 | 40 |
Wheel 5 | 60 | Tyre 2 | 60 |
I hope my request is clear and thanks in advance for any help!
Greetings,
Tim
Solved! Go to Solution.
@timfrikkee , Create a new column
new column =
var _t1 = [Article Code]
return
[Quantity] + sumx(filter(Table, Table[Contains Tyre] = _t1),[Quantity])
@timfrikkee , Create a new column
new column =
var _t1 = [Article Code]
return
[Quantity] + sumx(filter(Table, Table[Contains Tyre] = _t1),[Quantity])
Hello Amitchandak,
I use above solution in a calculation per month. However, the combinations of tyre and wheel can differ per month (sometimes we only have one combination sometimes two) and the formula seems to only sum those months where all combinations are present. The months in which only one tyre and wheel combination is present are not summed.
Do you a solution for this issue?
Thanks!
Wauw thank you so much that worked perfectly and a very quick response! One more question though is that I need this to be also filtered per date. How can I insert that into this formula?
Thanks a lot!
Hello community, I have found that the solution to my question above was a calculate and allexcept combination.
new column =
var _t1 = [Article Code]
return
[Quantity] +
Calculate(
sumx(filter(Table, Table[Contains Tyre] = _t1),[Quantity]) ,
allexcept(table, Table[date])
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
102 | |
84 | |
79 | |
68 |
User | Count |
---|---|
120 | |
110 | |
94 | |
81 | |
77 |