cancel
Showing results for
Did you mean:
Frequent Visitor

## 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%

 Client Yes No Don’t Know Total Don’t know /Total column A 2 0 0 2 0% B 39 11 8 58 19% C 21 23 8 52 44%

Any help would be appreciated, thanks

1 ACCEPTED SOLUTION
Community Support

Hi @DL123 ,

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.

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.
5 REPLIES 5
Community Support

Hi @DL123 ,

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.

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.
Frequent Visitor

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

Community Support

Hi @DL123 ,

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.

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.
Frequent Visitor

@v-xuding-msft  Thank you so much for the help, however i'm still a bit stuck!

In your measure , where can i find the  [Values] field in my posted example?

('Table'[Values])

Community Support

Hi @DL123 ,

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.

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.

Announcements

#### Happy New Year from Power BI

This is a must watch for a message from Power BI!