<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to interpolate data that is in groups to estimate missing values? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559432#M72771</link>
    <description>&lt;P&gt;Yes, you'll see I have already gotten the previous and next values needed for the formula, but it is not giving the correct results.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 05 Jun 2022 10:37:17 GMT</pubDate>
    <dc:creator>justlogmein</dc:creator>
    <dc:date>2022-06-05T10:37:17Z</dc:date>
    <item>
      <title>How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559397#M72769</link>
      <description>&lt;P&gt;I am currently doing an engine oil analysis for mining equipment and I have noticed that many of the engine hour readings on the oil sample cards are incorrect. Some are obvious outliers, but others are more subtle. All of the readings should stay the same or increase as the date increases, but some dip on the next date or go up on a previous date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because I can't work out which of these readings is the incorrect one in all scenarios, I thought it would be best to simply remove any I am not sure about (including the outliers) and then interpolate the readings using the dates as the independent variable. I also need to group these by machine, called Unit Number in the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having some trouble interpolating and am finding very little information on DAX interpolation. I have tried to do it myself using the Y = Y1 + (Y2 - Y1)/(X2 - X1) * (X - X1) formula, but it doesn't seem to be working for me. Would someone mind looking at my code to see how I can complete the very last column? (I have done this in an Excel file as Power BI has a limit on the rows you can enter into Power Query manually, which would mean two separate files).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://jmservicescomau-my.sharepoint.com/:x:/g/personal/jacob_jmservices_com_au/ERtRJdaa2xpGn2qTZj-k3ZoBlHCMOJnUXLhqG37IEC7S1g?e=SW6wld" target="_self"&gt;DAX Interpolation Problem&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 09:39:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559397#M72769</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-05T09:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559429#M72770</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the solutions to the question you posted earlier to get the previous and next Y values and X values and&amp;nbsp;calculate the interpolated value&amp;nbsp;with the formula you show&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 10:34:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559429#M72770</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2022-06-05T10:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559432#M72771</link>
      <description>&lt;P&gt;Yes, you'll see I have already gotten the previous and next values needed for the formula, but it is not giving the correct results.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 10:37:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559432#M72771</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-05T10:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559440#M72772</link>
      <description>&lt;P&gt;Can you share the pbix where youa re implementing this? I do not see any formula in the Excel you shared and in any case we'd still ave to look at the DAX code to see what is wrong &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 10:41:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559440#M72772</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2022-06-05T10:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559483#M72773</link>
      <description>&lt;P&gt;In the Excel file, go to Data &amp;gt; Load Data Model&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 11:28:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559483#M72773</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-05T11:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559640#M72779</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Here is the sample file with the solution&amp;nbsp;&lt;A href="https://www.dropbox.com/t/iRbNBQW2Jfh0ylaw" target="_blank"&gt;https://www.dropbox.com/t/iRbNBQW2Jfh0ylaw&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;=
VAR CurrentValue = [Engine Meter Reading - Valid Only]
VAR CurrentDate = 'Sample Data'[Sample Date]
VAR CurrentUnitTable = FILTER ( CALCULATETABLE ( 'Sample Data', ALLEXCEPT ( 'Sample Data', 'Sample Data'[Unit Number] ) ), [Engine Meter Reading - Valid Only] &amp;lt;&amp;gt; BLANK ( ) )
VAR DatesBefore = FILTER ( CurrentUnitTable, 'Sample Data'[Sample Date] &amp;lt; CurrentDate )
VAR DatesAfter = FILTER ( CurrentUnitTable, 'Sample Data'[Sample Date] &amp;gt; CurrentDate )
VAR PreviousDate = MAXX ( DatesBefore, 'Sample Data'[Sample Date] )
VAR NextDate = MINX ( DatesAfter,  'Sample Data'[Sample Date] )
VAR DateDifference1 = DATEDIFF ( PreviousDate, NextDate, DAY ) 
VAR DateDifference2 = DATEDIFF ( PreviousDate, CurrentDate, DAY ) 
VAR PreviousValue = MAXX ( FILTER ( DatesBefore, 'Sample Data'[Sample Date] = PreviousDate ), 'Sample Data'[Engine Meter Reading - Valid Only] )
VAR NextValue = MAXX ( FILTER ( DatesAfter, 'Sample Data'[Sample Date] = NextDate ), 'Sample Data'[Engine Meter Reading - Valid Only] )
VAR ValueDifference = NextValue - PreviousValue
RETURN
	IF ( ISBLANK ( CurrentValue ), PreviousValue + DIVIDE ( ValueDifference, DateDifference1 ) * DateDifference2, CurrentValue )&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 05 Jun 2022 16:14:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559640#M72779</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-05T16:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559710#M72783</link>
      <description>&lt;P&gt;Thank you Tamer. I see that there are some large jumps in the hours in the output there. I would have expected the interpolated data (for missing values) to be half the difference of the two two known numbers on each side of it, so essentially a straight line between between the known ones. I'm wondering if the multiple missing values in a row is affecting the calculation?&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 21:47:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2559710#M72783</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-05T21:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560082#M72798</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Actually I have double checked. There is no problem with the interpolation. It is 100% accurate but the thing is you the intervals in the x-axis are not uniform which makes the chart looks odd. I think you need to proceed with a different aproach uniforming the intervals at the x-axis.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 04:36:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560082#M72798</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-06T04:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560559#M72822</link>
      <description>&lt;P&gt;Thank you. Would you happen to know how I could do this in DAX? I could easily interpolate the data, even if not uniform, in Excel, but I am not that experienced with DAX to know what formulas to use.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 08:31:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560559#M72822</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-06T08:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560611#M72826</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;What is the time interval that you're looking for?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 08:43:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560611#M72826</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-06T08:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560623#M72827</link>
      <description>&lt;P&gt;Only for those dates that are on there. The dates will be sporadic, but all I am trying to do is fill in the gaps for the missing ones i.e. draw a direct across the top of the known ones on the graph and fill up to that line for the missing dates.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 08:46:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560623#M72827</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-06T08:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to interpolate data that is in groups to estimate missing values?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560727#M72835</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;You can create a date table and use it for slicing. A measure will be more practical than a calculated column&amp;nbsp;&lt;A href="https://www.dropbox.com/t/fEcL3Hmb9Ob0ea3Q" target="_blank"&gt;https://www.dropbox.com/t/fEcL3Hmb9Ob0ea3Q&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Engine Hours:=VAR CurrentValue = MAX ( 'Sample Data'[Engine Meter Reading - Valid Only] )
VAR MaxDateWithData = CALCULATE ( MAX ( 'Sample Data'[Sample Date] ), ALL ( 'Calendar' ) )
VAR CurrentDate = MAX ( 'Calendar'[Date] )
VAR CurrentUnitTable = FILTER ( CALCULATETABLE ( 'Sample Data', ALLEXCEPT ( 'Sample Data', 'Sample Data'[Unit Number] ) ), [Engine Meter Reading - Valid Only] &amp;lt;&amp;gt; BLANK ( ) )
VAR DatesBefore = FILTER ( CurrentUnitTable, 'Sample Data'[Sample Date] &amp;lt; CurrentDate )
VAR DatesAfter = FILTER ( CurrentUnitTable, 'Sample Data'[Sample Date] &amp;gt; CurrentDate )
VAR PreviousDate = MAXX ( DatesBefore, 'Sample Data'[Sample Date] )
VAR NextDate = MINX ( DatesAfter,  'Sample Data'[Sample Date] )
VAR DateDifference1 = DATEDIFF ( PreviousDate, NextDate, DAY ) 
VAR DateDifference2 = DATEDIFF ( PreviousDate, CurrentDate, DAY ) 
VAR PreviousValue = MAXX ( FILTER ( DatesBefore, 'Sample Data'[Sample Date] = PreviousDate ), 'Sample Data'[Engine Meter Reading - Valid Only] )
VAR NextValue = MAXX ( FILTER ( DatesAfter, 'Sample Data'[Sample Date] = NextDate ), 'Sample Data'[Engine Meter Reading - Valid Only] )
VAR ValueDifference = NextValue - PreviousValue
VAR Result =
	IF ( 
		MaxDateWithData &amp;gt;= CurrentDate,
		IF ( ISBLANK ( CurrentValue ), PreviousValue + DIVIDE ( ValueDifference, DateDifference1 ) * DateDifference2, CurrentValue )
	)
RETURN
	Result&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 09:19:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-interpolate-data-that-is-in-groups-to-estimate-missing/m-p/2560727#M72835</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-06T09:19:11Z</dc:date>
    </item>
  </channel>
</rss>

