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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jwesle
Frequent Visitor

Finding Percent of Total within Table

Hello, I am having difficulty determining how to find a % of total values based on multiple criteria within one table. The data table contains a Cust ID column, a Location Column, and an Item ID column. It's difficult to put into words, but I am trying to determine the percentage of items that are within each Cust ID and Location pairing (each Cust ID would add up to 100%). Example: For Cust ID 20001, there are six total items. One in Location 12 (17%), 2 in Location 14 (33%), and three in Location 20 (50%).

 

Raw Data:

Cust IDLocationItem ID
20001121
20001142
20001143
20001204
20001205
20001206
35000127
35000128
35000149
350001410
350001411

 

Desired Output:

Cust IDLocation% of ID/Loc
200011217%
200011433%
200012050%
350001240%
350001460%

 

Is there any way to create this view?

 

Thanks!

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @jwesle

 

Try this, where Table1 is the name of the table shown

 

1. Set Table1[Cust ID] and Table1[Location] in the rows of a matrix visual 

2. Set this measure in values of the matrix visual:

 

 

Percentage of ID/Loc =
DIVIDE (
    COUNT ( Table1[Item ID] ),
    CALCULATE ( COUNT ( Table1[Item ID] ), ALL ( Table1[Location] ) )
)

 

View solution in original post

2 REPLIES 2
AlB
Super User
Super User

Hi @jwesle

 

Try this, where Table1 is the name of the table shown

 

1. Set Table1[Cust ID] and Table1[Location] in the rows of a matrix visual 

2. Set this measure in values of the matrix visual:

 

 

Percentage of ID/Loc =
DIVIDE (
    COUNT ( Table1[Item ID] ),
    CALCULATE ( COUNT ( Table1[Item ID] ), ALL ( Table1[Location] ) )
)

 

jwesle
Frequent Visitor

Thank you. I was able to get it to work using the code below.

 

Much appreciated.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.