Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
flexxus
New Member

Calculate Average excluding gaps

Hello! I have a visual object type "Matrix" that shows in a column the "Clients", "Year 2016", "Year 2017", "Year 2018", "Year 2019" I need to calculate a new column that calculates the average of the last 3 years (2016 + 2017 + 2018) per client.

Example:

ScreenShot011.png

When a year does not contain value, I need the average to calculate it dividing only by values ​​other than "null". Example: The family "APPAS VICTOR EDUARDO" should calculate the average = (229.324 + 135.134) / 2 = 182.229 The truth is that I do not know how to calculate it. In Excel I use the function Average.SI and exclude the 0. Can someone help me or guide me?

This is a screen print of my table in Power BI:

ScreenShot010.png

 

Thank you!

 

2 REPLIES 2
Greg_Deckler
Super User
Super User

Is that how your source data is formatted? I would highly recommend that you unpivot your year columns. Should mame what you are trying to do much simpler.


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Thanks Greg! The origin data are the different sales that were made. My client requests to see all those accumulated sales for the different years. How would you say I should show it?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors