Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mwbowers
New Member

Matrix visual - using a row total in a calculation

I am building a small, fairly simple report for my finance department.  They do analysis of total AR and AP transactions, per employee per day, per month and year to date.

The data set is fairly simple and straight forward.  Basically 7 columns.  One column is a user id column, and I created a new column converting user names to Full Name.  To get total count of transactions per user, I wrote a very simple measure that is just a COUNT of all rows on the voucher column. 

Visual is a matrix view, with stepped layout and +/- turned off.

I used the above measure on the matrix visual to get total transactions per user.  On a per user level, I get row total and grand total.

What I need to do is get a PERCENT of transaction count per user.  So if User A had 176 transactions for May, and the total count for May is 3709, I need to divide the user count by the total for that month across all users and have a percent.

What I am wondering is, the possibility of a measure or calculated column that would supply the percentage per user… but that seems to require me to through code, get that individual count and total count… I do not know if that is possible or how to do that.

See report here:   https://tinyurl.com/mrspct9t

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @mwbowers ,

 

Please try:

Percentage = 
var _total = CALCULATE(COUNT('AR Transactions'[Voucher]),FILTER(ALL('AR Transactions'),MONTH('AR Transactions'[CreatedDate])=MONTH(MAX('AR Transactions'[CreatedDate]))))
return DIVIDE([ARTransCount],_total)

Then change the format of the measure to percentage:

vjianbolimsft_0-1666838079057.png

Final output:

vjianbolimsft_1-1666838096448.png

Best Regards,

Jianbo Li

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

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @mwbowers ,

 

Please try:

Percentage = 
var _total = CALCULATE(COUNT('AR Transactions'[Voucher]),FILTER(ALL('AR Transactions'),MONTH('AR Transactions'[CreatedDate])=MONTH(MAX('AR Transactions'[CreatedDate]))))
return DIVIDE([ARTransCount],_total)

Then change the format of the measure to percentage:

vjianbolimsft_0-1666838079057.png

Final output:

vjianbolimsft_1-1666838096448.png

Best Regards,

Jianbo Li

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.