Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Create a measure based on total column value

 

Hi all,

 

I'm trying to figure a way creating a measure based on the total amount column. So far the example below:

 

Client B= 11/58= 19% 

 

        
ClientYesNoDon’t KnowTotalDon’t know /Total column  
A20020%  
B391185819%  
C212385244%  
        

 

Any help would be appreciated, thanks

  • Hi Anonymous ,

    The "Values" is the one that is put into the values field in Matrix.  Here is my data model.  

    Data ModelIn Matrix

    I attached my sample that you can reference. If this is not what you want, please point out the difference between your data model and mine?

     

    Best Regards,

    Xue Ding

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

5 Replies

  • v-xuding-msft's avatar
    v-xuding-msft
    Community Support

    Hi Anonymous ,

    You could use the function of DIVIDE to implement it. For your expected output, you want to calculate "No/Total". But in the sample data, you wrote "Don't know/Total column". I calculated both of them that you can have a try.

    No/Total = DIVIDE(SUM('Table 1'[No]),SUM('Table 1'[Total]))
    Don't know/Total = DIVIDE(SUM('Table 1'[Don’t Know]),SUM('Table 1'[Total]))

    Best Regards,

    Xue Ding

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-xuding-msft , thanks for taking the time to look at this.

       

      However, im still having a problem with the using the divide function. How do i calculate if:

       

       

      a) the columns are not a  separate field in the report,  but is  grouped .Eg  the "Yes" and "No" is  grouped under the field name of "Outcomes grouped". 

       

      b)the "total column" is not a field , but rather is generated from the "Column subtotals" option in the visualisation.

       

      Regards

      • v-xuding-msft's avatar
        v-xuding-msft
        Community Support

        Hi Anonymous ,

        I guess that you use a matrix to show the value. I modify my table and create a new measure that you can have a try.

        Measure = 
        var subtotal = CALCULATE(SUM('Table'[Values]),ALLSELECTED('Table'[Outcomes grouped]))
        var no = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Outcomes grouped] = "No"))
        return
        DIVIDE(no,subtotal)

        Best Regards,

        Xue Ding

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