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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
axn1948
New Member

Subtotal for Min values not adding up

Hi All, 

 

I am pretty new to Power BI and have an issue regarding the subtotal values. I have an assignment where I need to create two matrix visuals based on specific labor types (type 1 and type 2 labor). Only way to get values for these labor types is based on the Min and Max aggregation. Min aggregation gets the  data for type 2 labor and max aggregation gets data for type 1 labor. Here is how the chart looks: 

 

axn1948_0-1691989675148.png

Now issue I am having is that the values for labor hours and total direct cost (type 1 is based on max, and type 2 is based on min) are not adding up correctly in the row subtotal section as you can see in above image. What is the issue here? 

 

I have also attached a sample application as well 

https://www.dropbox.com/scl/fi/0vnzmdibcct2r57qyvffs/Sample.pbix?rlkey=3op2ddm0jq8seduq231rzkusv&dl=...

 

Thanks

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @axn1948 ,

 

You can create 4 measures by using the SUMMARIZE function to fix it.

max_hours = VAR _TABLE=SUMMARIZE('Matrix',[name],[description],[labor_unit],[labor_productivity],"Value",MAX('Matrix'[labor_hours]))
RETURN SUMX(_TABLE,[Value])
max_total = VAR _TABLE=SUMMARIZE('Matrix',[name],[description],[labor_unit],[labor_productivity],"Value",MAX('Matrix'[labor_total]))
RETURN SUMX(_TABLE,[Value])

 

min_hours = VAR _TABLE=SUMMARIZE('Matrix',[name],[description],[labor_unit],[labor_productivity],"Value",MIN('Matrix'[labor_hours]))
RETURN SUMX(_TABLE,[Value])
min_total = VAR _TABLE=SUMMARIZE('Matrix',[name],[description],[labor_unit],[labor_productivity],"Value",MIN('Matrix'[labor_total]))
RETURN SUMX(_TABLE,[Value])

vstephenmsft_0-1692169422084.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

 

Hi Stephen,

 

i realize I had made a mistake with the sample app. In the data model the fields are not from the same table. Labor hours, total cost, and description come from one table item. Name comes from a different table, and it isnt directly related with the item table. Productivity and unit come from a separate table as well but that is directly linked to the item table.

 

So whenever I try to create an expression, my table always goes into a timeout error or memory error. Whaf do I do here?

Idrissshatila
Super User
Super User

Hello @axn1948 ,

 

so the Min & Max functions won't sum in a total, they just give you the minimum of the column or the max.

check this out

https://youtu.be/6rgAkejrup8

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.