Forum Discussion

kozlevchar's avatar
kozlevchar
Icon for Resolver I rankResolver I
6 years ago
Solved

Create a Subtotal of a Measure

I work with Bill of Material data down to the ingredient level.  To get correct numbers the SKU volume produced has to be applied to each ingredient so the volume gets repeated several times per SKU.  To get the correct SKU volume I created a measure: 

 
Volume Sum = CALCULATE(SUM('Volume Table'[Volume]) , FILTER('BoM Master' , 'BoM Master'[SKUVendor#]))

 

We have several manufacturers of these SKUs.  My question is how do I create a measure that subtotals the measure above by Manufacturer and then another level up by Division.  I need a 'subtotal measure' of a filtered measure.  

 

Here's what it looks like with subtotals added in the matrix visual:

 

 

I need the subtotal measure so I can divide and get a percentage.

 

Thanks very much,

 

John

 

 

 

 
 
 
  • Thank you for the reply.  That subtotal measure gives me the overall total not a subtotal.  Maybe ALLEXCEPT function may work.  I will attempt and reply

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  kozlevchar 

     

    You can create you "subtotal" measure like: 

    = CALCULATE(SUM('Volume Table'[Volume]), ALL('Volume Table'[SKU]))

    a percentage would then be:

    = divide ( SUM('Volume Table'[Volume]), CALCULATE(SUM('Volume Table'[Volume]), ALL('Volume Table'[SKU])))

     
    The would be something like: 

    You can create you "subtotal" measure like: 

    = CALCULATE(SUM('Volume Table'[Volume]), ALL('Volume Table'[SKU]), ALL('Volume Table'[Company]))

    a percentage would then be:

    = divide ( SUM('Volume Table'[Volume]), CALCULATE(SUM('Volume Table'[Volume]), ALL('Volume Table'[SKU]), ALL('Volume Table'[Company])))

     

    the ALL() function removes the filter for that specific column (in this case).

     

    Jan 

    • kozlevchar's avatar
      kozlevchar
      Icon for Resolver I rankResolver I

      Thank you for the reply.  That subtotal measure gives me the overall total not a subtotal.  Maybe ALLEXCEPT function may work.  I will attempt and reply