cancel
Showing results for
Did you mean:  Helper I

## Percentage of Total Metrics per Column (not Overall)

I would like the visual to take the total number of Inspections per month, add them, and show me the percentage (by month) of how many are on time.  When I use "show percentage" option, it shows overall instead of by month.  What kind of Measure formula can I use so that it calculates this for me?

My data with counts of Inspections: What Power BI does: But I want it to say January = 79%, February =84%, etc.

January = 30/38

February = 38/45

etc.

If it helps... my spreadsheet/datasource is something like this:

Column A = Inspection number (unique identifier)
Column B = Date
Column C = On-Time or Past Target

3 ACCEPTED SOLUTIONS  Solution Sage  Hi @abeiswinger,

I reproduced you data and created this measure ( for details check pictures below):

Rat = DIVIDE(CALCULATE(SUM(TestData[OTT]),FILTER(TestData,TestData[Descr]="On Time")),CALCULATE(SUM(TestData[OTT])))  Microsoft

Please refer to the steps below to acheive your requirement.

1. Sample data. 2. Create a masure by using DAX below.
Measure = CALCULATE(SUM(Table1[InspectionNumber]),FILTER(ALLEXCEPT(Table1,Table1[Month]),Table1[Type2]="On-Time"))/CALCULATE(SUM(Table1[InspectionNumber]),ALLEXCEPT(Table1,Table1[Month]))
3. User this measure in your visual. Regards,

Charlie Liao  Helper I  8 REPLIES 8  Microsoft

Please refer to the steps below to acheive your requirement.

1. Sample data. 2. Create a masure by using DAX below.
Measure = CALCULATE(SUM(Table1[InspectionNumber]),FILTER(ALLEXCEPT(Table1,Table1[Month]),Table1[Type2]="On-Time"))/CALCULATE(SUM(Table1[InspectionNumber]),ALLEXCEPT(Table1,Table1[Month]))
3. User this measure in your visual. Regards,

Charlie Liao  Helper I

@v-caliao-msft

So close!  For some reason all my data now displays as the same?? Screenshot below of what it looks like with the measure, as well as what I have in my Visualizations... how can this be corrected?  My January data should be 79% and February should be 84%, etc...  Helper I    Solution Sage  Hi @abeiswinger,

I reproduced you data and created this measure ( for details check pictures below):

Rat = DIVIDE(CALCULATE(SUM(TestData[OTT]),FILTER(TestData,TestData[Descr]="On Time")),CALCULATE(SUM(TestData[OTT])))  Helper I

@Interkoubess

Sorry, this formula is not working for me.  Can you please explain what each value is supposed to be?  I'm not sure where data is being pulled from:

Rat = DIVIDE(CALCULATE(SUM(TestData[OTT]),FILTER(TestData,TestData[Descr]="On Time")),CALCULATE(SUM(TestData[OTT])))

I'm assuming that anything that says [TestData[OTT] = the name of the tab (from Excel datasource) and the title of the column that I want to pull the "On-Time" or "Past Target" from?

So in the red, and blue, and green text... I change to mine.  However, what should I input for the blue bold text?  if I only put the tab name, I recieve an error message: MdxScript(Model) (3,46) Calculation error in measure 'WO Detail'[RAT]: The function SUM cannot work with the values of type String.

WO Detail is the name of my tab.  Solution Sage

Hi @abeiswinger,

You are trying to sum up a string value.

'WO Detail'[RAT]: The function SUM cannot work with the values of type String.

Please change the type of data for example to Whole number or Decimal ones, etc...

From what you told me, the formula will be :

Rat = DIVIDE(CALCULATE(SUM('WO Detail'[RAT]:),FILTER('WO Detail','WO Detail'[the field you have on time]="On Time")),CALCULATE(SUM('WO Detail'[RAT])))

Furthermore a sample could help if you cannot apply this formula to your model.

Please dont hesitate if I can help.

Thx, Ninter  Helper I

@Interkoubess

What do you mean by "Please change the type of data for example to Whole number or Decimal ones, etc..."

Do I leave the [RAT] in the formula, or should that be changed as well?

Thanks  Solution Sage

Hi @abeiswinger.

Your column named RAT is a string ( for example your name and surname you cannot add them as a sum).

And this is whqt you qre trying to do.

Select the column is PowerQuery for example and change the data type.

Let us know.

Thanks Announcements #### The Power BI Community Show

Watch the playback when Amit Chandak, a Power BI Super User, demos how to use Field Parameters to make reports more dynamic. #### New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison! #### Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate. Top Solution Authors
Top Kudoed Authors
Users online (6,011)