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
Applicable88
Impactful Individual
Impactful Individual

Sum value of all rows after selection

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

Applicable88_0-1632671485842.png

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:

 

Applicable88_11-1632673270220.png

 

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

Measure1 = CALCULATE(sum(Table1[PrepTime]))+CALCULATE(sum(Table1[ProdTime]))
But it automatically generates additional rows which is not would show the facttable in a wrong and confused way , so end up with having many rows:
Applicable88_14-1632673515364.png

 

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. 

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Applicable88 

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_0-1632674547437.png

 

 

View solution in original post

2 REPLIES 2
Applicable88
Impactful Individual
Impactful Individual

@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. 

 

jdbuchanan71
Super User
Super User

@Applicable88 

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_0-1632674547437.png

 

 

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.