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
damit23183
Employee
Employee

Average of Percentage Column

Calculate Average of %.JPG

 

 

 

 

 

 

 

Hi,

 

I would like one help to calcualte average of Health% column as you can see above. Health% column is Measure i have created based on logic. I need to calcualte Average of Health% in CUSTOMER EXPERIANCE box where currently result is INFINITY. The result should be 93.37% instead of Infinity if you sum of Health% values divide by 3 because there are 3 KPI.

 

In future, KPI will increase for sure so looking for dynamic solution if there will be 5 KPI then SUM of Health% should be divide by 5. And So on.

 

I tried by below formula:

 

Measure = DIVIDE (Health%, No of KPI)

 

WHere No of KPI = COunt (KPI Name) but its not working.

 

Any help would be appreciated!

 

Thanks

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

So, what you want to do is to create a table variable that is the same as your visual displayed and then do an AVERAGEX across it. So let's say that you have a table with exactly the columns you have in your visual minus your measure, you would do this:

 

Average of Measure =
  VAR __Table = 
    ADDCOLUMNS(
      'Table',
      "__Health %",[Health %]
    )
RETURN
  AVERAGEX(__Table,[__Health %])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

So, what you want to do is to create a table variable that is the same as your visual displayed and then do an AVERAGEX across it. So let's say that you have a table with exactly the columns you have in your visual minus your measure, you would do this:

 

Average of Measure =
  VAR __Table = 
    ADDCOLUMNS(
      'Table',
      "__Health %",[Health %]
    )
RETURN
  AVERAGEX(__Table,[__Health %])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Awesome that worked like charm.

 

Thank you so much.

 

Thanks

Ashish_Mathur
Super User
Super User

Hi,

Do any of these work?

No of KPI = Counta(KPI Name)

No of KPI = DISTINCTCOUNT(KPI Name)

If not, then share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

Thank you for your response. 

 

Unfortunately, i wont be able to send you PBIX file due to data privacy. However, none of count work. 

 

Is there any other work around to get what i am looking for?

 

Thanks

Hi,

Try this

=IF(HASONEVALUE(Data[KPI]),[Health%],AVERAGEX(SUMMARIZE(VALUES(Data[KPI]),Data[KPI],"Avg",[Health%]),[Avg]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.