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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
ShaGuna32
Helper I
Helper I

Measure to Calculate Percentage

Hi Team,

 

Good day, all,

 

I am trying to calculate a percentage of data using a measure in the matrix table format.

 

Vendor Name the Row, In the values, I have M category and M %(this is the field I am trying to work)

ShaGuna32_0-1695251573177.png

While I am trying this in the matrix table option in the report, 
I couldn't able to bring the M category total value divided by the particular M Category. Because the same M category is used in the column, the total value is categorized in the M % calculation. It is stopping me from pursuing further.

Any ideas are highly appreciated, thanks.

Thanks
ShaGuna



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ShaGuna32 ,

I created a sample pbix file(see the attachment) base on your provided data, please find the details in it. You can create a measure as below to get it:

M % = 
VAR _vendor =
    SELECTEDVALUE ( 'Table'[Vendor] )
VAR _per =
    COUNT ( 'Table'[Product Rack] )
VAR _total =
    CALCULATE (
        COUNT ( 'Table'[Product Rack] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Vendor] = _vendor )
    )
RETURN
    DIVIDE ( _per, _total )

vyiruanmsft_0-1695622809628.png

Best Regards

View solution in original post

9 REPLIES 9
ShaGuna32
Helper I
Helper I

Hi @Anonymous ,

 

Good day,


Thanks for your reply, much appreciated.
First of all, I need to count the M for the total in each M category for the vendors, 
Then I want to Divide the count of M by the total of the M category for the vendor(with out excluding the vendor or that particular count of M).

Hope I am not confusing you, Please do reach out if need any clarifications.
Looking forward to your suggestion, thanks.

Have a nice day, 

kind Regards
ShaGuna

Anonymous
Not applicable

Hi @ShaGuna32 ,

Please update the formula of measure as below and check if it can get your expected result.

Measure =
VAR _count =
    COUNT ( 'Table'[M Category] )
VAR _total =
    CALCULATE (
        SUM ( 'Table'[M Category] ),
        ALLEXCEPT ( 'Table', 'Table'[Vendor] )
    )
RETURN
    DIVIDE ( _total, _count )

If the above one still can't help you get your expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

Best Regards

Hi @Anonymous ,

Unfortunately not. 

It is dividing the same value and returns 1.

Thanks
ShaGuna

Anonymous
Not applicable

Hi @ShaGuna32 ,

Could you please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

Best Regards

Hi @Anonymous ,

 

Sure can,

I am trying to calculate the Material Quality percentage of our suppliers. We have a ranking from 0 to 12 for each material. Each and every material will be ranked according to their supply quality. So every vendor's individual product will be ranked at the end of the process. 

Dummy Data (Raw Model), 

VendorProduct RackMaterial Quality Grade
Vendor 1R1 (random generated number )5
Vendor 2R 26
Vendor 3R 33
Vendor 4R 41
Vendor 5R 57
Vendor 6R 64
Vendor 7R 79
Vendor 8R 810
Vendor 9R 92


The team using V-LookUp  at the data in such a way, That will easily allow them to categorize by the number of products in each ranking Category by counting the number ranks for each vendor product

ShaGuna32_0-1695618375697.png

What I want to do in Power BI is the following,

ShaGuna32_1-1695619617199.png

Unfortunately, I am not sure how to use the total Count of each Rank divided by the Grand Total.
I have done an SQL script to have the Vendor, Product Rack, and Material Quality Grade in the same table. 
Hope this gives you some understanding, much appreciate for your time and help.

Thanks
ShaGuna

Anonymous
Not applicable

Hi @ShaGuna32 ,

I created a sample pbix file(see the attachment) base on your provided data, please find the details in it. You can create a measure as below to get it:

M % = 
VAR _vendor =
    SELECTEDVALUE ( 'Table'[Vendor] )
VAR _per =
    COUNT ( 'Table'[Product Rack] )
VAR _total =
    CALCULATE (
        COUNT ( 'Table'[Product Rack] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Vendor] = _vendor )
    )
RETURN
    DIVIDE ( _per, _total )

vyiruanmsft_0-1695622809628.png

Best Regards

Hi @Anonymous and Everyone


Thanks for the below solution @Anonymous 

I have achieved results as follows, 

ShaGuna32_0-1697004248306.png

Now, 
I would like to use the Grand Total average values in the empty cells in the column, or the values above or below in the column. 

I tried to use MAX, Earlier functions but they are used only if I have a calculated column. I have created a measure for the previously suggested formula. Tried to create a calculated column but isn't working correctly.

Any ideas for the same will be highly appreciated, 
Looking forward to any ideas and suggestions, thanks.


Kind Regards
ShaGuna

HI @Anonymous ,

Much appreciated for your support in this issue, thank you so much,
It worked well, Thanks.

Kind Regards

ShaGuna

Anonymous
Not applicable

Hi @ShaGuna32 ,

You can create a measure as below to get the M%:

Measure =
VAR _per =
    SUM ( 'Table'[M Category] )
VAR _total =
    CALCULATE (
        SUM ( 'Table'[M Category] ),
        ALLEXCEPT ( 'Table', 'Table'[Vendor] )
    )
RETURN
    DIVIDE ( _per, _total )

 

If the above one can't help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples.It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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