How to calculate average percentage in Power BI

0 votes

Right now I have a set of data in PowerBI as shown in the screenshot above. I have a Measure to calculate the % of OK:

total_student = COUNT(StudentAns[Name])

ok_% = 
VAR OK_COUNT = COUNTROWS(
    FILTER(
        StudentAns,
        StudentAns[Answer] = "OK"
    )
)

RETURN (OK_COUNT/StudentAns[total_student])

I created a Matrix to show the % of OK for each month as shown in the screenshot below:

The average percentage for all of the months is what I'm looking for. As a result, the final output response should be 89.05 percent, which is calculated as the average of 85.95 percent, 91.4 percent, 89.27 percent, and 89.58 percent.

Because I want to use the result as a Target Goals for KPI visualisation, I want to get the average % of OK throughout all of the months.

Feb 23 in Power BI by surbhi
• 3,810 points
246 views

1 answer to this question.

0 votes

You can add one more measure to the matrix as follows:

ok_2 % =
IF(
    HASONEVALUE( 'StudentAns'[Month] ),
    [ok_%],
    AVERAGEX(
        VALUES( StudentAns[Month] ),
            [ok_%]
    )
)


It calculates your original measure for each month, but it returns the average of your measure's results for the Totals.

HASONEVALUE is a function that returns a value. True if the filtered context contains just one distinct value; AVERAGEX calculates the average of a series of expressions evaluated in each row; VALUES provides a list of distinct values.

answered Feb 23 by CoolCoder
• 4,360 points

Related Questions In Power BI

0 votes
1 answer

How to calculate average inventory in power bi?

Hi @There, Is there any index field in ...READ MORE

answered Sep 28, 2020 in Power BI by Gitika
• 65,850 points
972 views
0 votes
1 answer

Using DAX calculation how to calculate monthly budget till today in power bi Desktop?

You can make use of this: MTD Budget ...READ MORE

answered Sep 24, 2020 in Power BI by Gitika
• 65,850 points
584 views
0 votes
1 answer

How to measure in DAX to calculate YTD for chosen month only for Power BI?

If you use the date column from FactTable, ...READ MORE

answered Dec 22, 2020 in Power BI by Gitika
• 65,850 points
1,730 views
0 votes
1 answer

To Calculate the Standard Deviation in Power BI

Suppose you've to obtain the Standard Deviation ...READ MORE

answered Nov 26, 2018 in Power BI by Upasana
• 8,620 points
12,223 views
0 votes
1 answer

Displaying Table Schema using Power BI with Azure IoT Hub

Answering your first question, Event Hubs are ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
518 views
+1 vote
1 answer

Unable to install connector for Power Bi and PostgreSQL

I think the problem is not at ...READ MORE

answered Aug 22, 2018 in Power BI by nirvana
• 3,130 points
1,763 views
+2 votes
2 answers

Migrate power bi collection to power bi embedded

I agree with Kalgi, this method is ...READ MORE

answered Oct 11, 2018 in Power BI by Hannah
• 18,570 points
600 views
+1 vote
1 answer

Connect power bi desktop to dataset and create custom reports

Yes using Power BI REST API to ...READ MORE

answered Sep 18, 2018 in Power BI by Kalgi
• 52,350 points
691 views
0 votes
1 answer

If there a way to have the current month by default in a KPI representing MoM% in Power BI

The PREVIOUSMONTH DAX function can be used ...READ MORE

answered Feb 16 in Power BI by CoolCoder
• 4,360 points
54 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP