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.
Hello,
after several approaches I seemingly still haven't found the solution to sum all rows after filtering with a slicer.
I have a classic data model with two tables, a dimension table and a facttable. The dimension table consist of
the Preparation Time and the Production Time of a material:
MaterialID | PrepTime | ProdTime | ||
1 | 1 | 3 | ||
2 | 2 | 2 | ||
3 | 5 | 5 | ||
4 | 3 | 2 | ||
5 | 2 | 8 | ||
6 | 2 | 2 | ||
7 | 6 | 2 |
Connecting it via the facttable which consist of orderdates, and the materialID which I need to connect to it looks like this
The two sum aggregation are the standard function within PowerBI.
I want to have a measure which also get the total value after i select a MaterialID:
Instead of 6 and 2 there should be the sum of these orders : 12 and 4.
The second measure I need is to calculate the total time of ProdTime and Prodtime together. I tried with this one
It also doesn't sum up all the Prep+Prod Time of those orders where material 5 and 7 is involved, it only sums it up one time and not according to the amount of orders.
If someone can take a look it would be highly appreciated. Attached is the Pbix file:
https://drive.google.com/drive/folders/1Jjew0XnCbGKwSRS6lky-KESplyCxBtGw?usp=sharing
Thank you very much in advanced.
Best.
Solved! Go to Solution.
Try it with these measures.
Prep Time = SUMX ( Table2, RELATED ( Table1[PrepTime] ) )
Prod Time = SUMX ( Table2, RELATED ( Table1[ProdTime] ) )
Prep + Prod = [Prep Time] + [Prod Time]
@jdbuchanan71 thank you very much! Seeing your function I guess I also understand whats happening here. Seems it didn't work out before because the two time columns are in the Table 2, but I'm actually filtering table1 with the selection. With the related() you expand table1 and bring the two Time column into the equation.
Thanks a lot.
Try it with these measures.
Prep Time = SUMX ( Table2, RELATED ( Table1[PrepTime] ) )
Prod Time = SUMX ( Table2, RELATED ( Table1[ProdTime] ) )
Prep + Prod = [Prep Time] + [Prod Time]
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 |
---|---|
108 | |
98 | |
79 | |
67 | |
60 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |