Forum Discussion

axn1948's avatar
axn1948
New Member
3 years ago

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: 

 

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=0

 

Thanks

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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])

                                                                                                                                                             

    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.           

     

    • axn1948's avatar
      axn1948
      New Member

      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?