Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Microsoft Power BI Community
- Galleries
- Quick Measures Gallery
- Area Under a Curve Approximation

02-09-2019 21:52 PM - last edited 02-09-2019 21:54 PM

Greg_Deckler

Super User

Area Under a Curve Approximation

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-09-2019
09:52 PM

We can use a little bit of pre-Calculus knowledge to help us approximate (fairly accurately) the area under a curve. This can be useful in all sorts of situations as the area under a curve often has some sort of meaning, such as the amount of work performed, etc.

This Quick Measure presents 6 different lines/curves and the basic technique works for each of them. By using an approximation technique we can compute the area under any curve without having to solve differential equations and the like.

AreaAppoximation = VAR __table = ALL(X) VAR __max = MAXX(__table,[X]) VAR __min = MINX(__table,[X]) VAR __zero = IF(SIGN(__max) > 0 && SIGN(__min) < 0,1,0) VAR __increment = DIVIDE(__max - __min + __zero,COUNTROWS(__table)) VAR __table1 = ADDCOLUMNS(__table,"__area",[Y]*__increment) RETURN SUMX(__table1,[__area])

Essentially, compute an increment based upon the minimum and maximum x-axis values as well as the number of data points. Multiply each Y value by this increment in order to compute the area of a column that corresponds to that data point. Then you just sum up all of the areas of the columns. The more data points you have, the more accurate the calculation. This formula could potentially be combined with the Linear Interpolation Quick Measure to interpolate additional data points and improve accuracy.

Visual representations of the columns created by the measure are shown to provide a better understanding to the viewer.

eyJrIjoiYTU5NDMyZWYtMTAwOC00NmIzLTlmODgtMGI4ODQ5MWVmMzFlIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9

Proud to be a Datanaut!