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, 2022 in Power BI by surbhi
• 3,820 points
6,002 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.

Are you ready to take your data visualization skills to the next level? Join our Power BI Training Course and learn how to transform your raw data into interactive and insightful reports!

answered Feb 23, 2022 by CoolCoder
• 4,420 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,770 points
2,715 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,770 points
1,840 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,770 points
4,870 views
0 votes
1 answer

How do I calculate a rolling average or cumulative total in Power BI without performance issues?

When working in Power BI, especially with ...READ MORE

answered Nov 7 in Power BI by pooja
• 4,690 points
31 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
1,311 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
2,722 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,520 points
1,492 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
1,646 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, 2022 in Power BI by CoolCoder
• 4,420 points
2,303 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP