Forum Discussion

srkase's avatar
srkase
Helper IV
7 years ago
Solved

CALCULATE PERCENTAGE

Hi 

 

I have created a matrix table in the following manner

 

branchproductspares%   
chennai10000500?   
       
  ? I want to create the percentage of spares on 10000

 

I have kept all the data in a single table... differentiated by category... category consists of product , spares and cable.

 

Kindly guide me... and thanks in advance

 

  • Hi srkase 

     

    Try this.

    % of Spares = 
    VAR _products = CALCULATE(
        SUM( YourTable[TOTAL QTY] ), 
        YourTable[CATEGORY] = "PRODUCT"
    )
    VAR _spares = CALCULATE(
        SUM( YourTable[TOTAL QTY] ), 
        YourTable[CATEGORY] = "SPARES"
    )
    RETURN DIVIDE( _spares, _products )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

6 Replies

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi srkase 


    Please can you provide a data sample?

    Best Regards,
    Mariusz

    Please feel free to connect with me.
    Mariusz Repczynski

     

     

      • Mariusz's avatar
        Mariusz
        Community Champion

        Hi srkase 


        You can create a sample table in excel and paste it here.

         

        Best Regards,
        Mariusz

        Please feel free to connect with me.
        Mariusz Repczynski

         

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi srkase 

     

    Try this.

    % of Spares = 
    VAR _products = CALCULATE(
        SUM( YourTable[TOTAL QTY] ), 
        YourTable[CATEGORY] = "PRODUCT"
    )
    VAR _spares = CALCULATE(
        SUM( YourTable[TOTAL QTY] ), 
        YourTable[CATEGORY] = "SPARES"
    )
    RETURN DIVIDE( _spares, _products )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

    • srkase's avatar
      srkase
      Helper IV

      thanks a lot..

       

      I have added drill down also..  how to calculate the drill down percentage for unit-id?