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
macgeorge
Helper I
Helper I

Percentage Column

Hi, I am having trouble with this table please see fig. a. It report view it shows this table with the wrong percentage totals for product 1 and 3.

 

Fig. a

macgeorge_1-1665732902948.png

 

I am using this code to work out the percentage and add a column:

 

% Compliant = ('Outcomes'[Spot Checks Compliant]/[Spot Checks Totals])
 
It is calculating the percentage based on the number of times the product number appears and then totalling the percentage. This is wrong. 
 
Fig. b - this is what the source data table looks like. 

 

macgeorge_0-1665732680994.png

 

I want the % Compliant field with the correct row percentages as shown here in fig. c:

 

Fig c - this shows the unique product number with the correct percentage compliant:

 

macgeorge_3-1665733429206.png

 

In fig.a it is presenting the product numbers correctly, but its adding the percentages together instead of consolidating the product number and then providing an overall percentage like in fig. c.

 

Is there anything that I can add to the code above that will do this please?

 

Thank you,

 

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

Hi @macgeorge ,

 

Please try:

%  Compliant = DIVIDE(SUM('Table'[Spot Checks Compliant]),SUM('Table'[Spot Checks Total]))

vcgaomsft_0-1665974841485.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

6 REPLIES 6
v-cgao-msft
Community Support
Community Support

Hi @macgeorge ,

 

Please try:

%  Compliant = DIVIDE(SUM('Table'[Spot Checks Compliant]),SUM('Table'[Spot Checks Total]))

vcgaomsft_0-1665974841485.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Yeah I can see this now. Thank you.

macgeorge
Helper I
Helper I

Apologies the tables seem to have lost its formatting - they should look like this:

 

Fig. a

macgeorge_0-1665962410073.png

 

Fig. b

macgeorge_3-1665962517292.png

 

Fig. c

macgeorge_2-1665962486868.png

 

 

 

macgeorge
Helper I
Helper I

Hello Ibendin, 

This is the 'Outcomes' table (Fig. a) I am using.

Fig. a

PrioritySpot Checks TotalsSpot Checks Compliant% Compliant
PRODUCT 1200%
PRODUCT 15360%
PRODUCT 133100%
PRODUCT 2800%
PRODUCT 424023096%
PRODUCT 315615197%
PRODUCT 317717297%
PRODUCT 32121100%
PRODUCT 5462452%

 

When I add a new column and use the DAX code below I get this table (Fig. b).

% Compliant = ('Outcomes'[Spot Checks Compliant]/[Spot Checks Totals])

 

Fig. b 

PrioritySpot Checks TotalsSpot Checks Compliant% Compliant
PRODUCT 1106160%
PRODUCT 2800%
PRODUCT 4240230192%
PRODUCT 3354344494%
PRODUCT 54624104%

 

The calculations in Fig. b for Spot Checks Totals and Spot Checks Compliant columns are correct. For example the code divides Spot Checks Compliant "6", with Spot Checks Totals "10" presents the % Compliant total (referencing Fig. A) incorrectly, when it should present 60% and not 160%.

 

Fig. c shows how I want the data to be presented in the required table below.

 

Fig. c

PrioritySpot Checks TotalsSpot Checks Compliant% Compliant
PRODUCT 110660%
PRODUCT 2800%
PRODUCT 424023096%
PRODUCT 335434497%
PRODUCT 5462452%

 

Is there anyway to use the totals as above in Fig. b and to produce the % on that table totals.

 

Does this make sense?

 

Thank you,



 

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Sorry I misspelled your name Ibendlin.

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.

Top Solution Authors
Top Kudoed Authors