topic Area Under a Curve Approximation in Quick Measures Gallery
https://community.powerbi.com/t5/Quick-Measures-Gallery/Area-Under-a-Curve-Approximation/m-p/620016#M294
<P>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.</P>
<P> </P>
<P>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.</P>
<P> </P>
<P> </P>
<PRE>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])</PRE>
<P>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 <A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Linear-Interpolation/m-p/330712" target="_self">Linear Interpolation Quick Measure</A> to interpolate additional data points and improve accuracy.</P>
<P> </P>
<P> </P>
<P>Visual representations of the columns created by the measure are shown to provide a better understanding to the viewer.</P>
<P> </P>
<P><SPAN class="reportid hidden">eyJrIjoiYTU5NDMyZWYtMTAwOC00NmIzLTlmODgtMGI4ODQ5MWVmMzFlIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9</SPAN></P>Sun, 10 Feb 2019 05:54:35 GMTGreg_Deckler2019-02-10T05:54:35ZArea Under a Curve Approximation
https://community.powerbi.com/t5/Quick-Measures-Gallery/Area-Under-a-Curve-Approximation/m-p/620016#M294
<P>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.</P>
<P> </P>
<P>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.</P>
<P> </P>
<P> </P>
<PRE>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])</PRE>
<P>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 <A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Linear-Interpolation/m-p/330712" target="_self">Linear Interpolation Quick Measure</A> to interpolate additional data points and improve accuracy.</P>
<P> </P>
<P> </P>
<P>Visual representations of the columns created by the measure are shown to provide a better understanding to the viewer.</P>
<P> </P>
<P><SPAN class="reportid hidden">eyJrIjoiYTU5NDMyZWYtMTAwOC00NmIzLTlmODgtMGI4ODQ5MWVmMzFlIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9</SPAN></P>Sun, 10 Feb 2019 05:54:35 GMThttps://community.powerbi.com/t5/Quick-Measures-Gallery/Area-Under-a-Curve-Approximation/m-p/620016#M294Greg_Deckler2019-02-10T05:54:35Z