![]() The fourth line grabs the temperature in the steam table that is just above the value we have for our temperature.The third line grabs the temperature in the steam table that is just below the value we have for our temperature.In other words, we will not have to interpolate a value, we already know it even though this would never happen in an Dr. The second line is looking to see if there is a match in the lookup table for the value that we have for our temperature.The first line is just grabbing the value of the Temperature from our Interpolation table for which we want to interpolate a value for Pressure.So, what this measure is doing is calculating the Pressure (MPa) from our steam table by interpolating between the known values of pressure at the specific temperatures listed in our steam table. VAR y1 = CALCULATE(MAX(H2OTempSat),FILTER(ALL(H2OTempSat),=x3)) VAR x1 = CALCULATE(MAX(H2OTempSat),FILTER(ALL(H2OTempSat),=x3)) VAR match = CALCULATE(MAX(H2OTempSat),FILTER(ALL(H2OTempSat),=x3)) In any event, create the following meausre: In fact, I would advise against it, although I have specifically engineered the formula to allow for active relationships between your interpolation table and the lookup table. Note that there is no reason to relate these tables to one another. Rename the single column in the table to Temp (C). You should now have an Interpolation table with numbers from 1 to 373 in increments of 1. You can do this by going to the Modeling tab of the ribbon and choosing New Parameter from the What If section or just click on New Table and use the following formula: Next, we want to create a table for our Interpolated values. OK, so what you should have loaded into a table now are the properties of water at temperatures in increments of 5 degrees Celcius from about 0 degrees to about 373 degrees. #"Changed Type2" Step 2: Create Interpolation Table #"Changed Type" = Table.TransformColumnTypes(Sheet2,) Source = Excel.Workbook(File.Contents(" C:\temp\powerbi\Thermo\H2O_TempSat.xls "), null, true), You will need to change the path in bold below for your own situation. OK, so anyway, the data takes a little clean up, here is my Power Query code for cleaning up and importing the data. Marquart's problems EVER involved water at a temperature that was actually in these steam tables. But the problem is that not a single, not a single one of Dr. How can we accomplish this? Well, we can assume that the values between our known values of f( x) approximately fall along a straight line, like so: So, for example, suppose we have a set of data points like the following for some unknown function f( x) (reference the Wikipedia page here):īut, what we are interested in is what the value of f( x) is for a value of x=2.5. Essentially, interpolation is a method of creating new data points within the range of a set of known data points. Interpolation falls into the mathematical field of numerical analysis. So, here is the technique, but first a little background. Besides, while we generally deal with known data in things like Power BI, having the ability to do interpolation could come in pretty handy for certain situations as well as "What If" analysis. And I figured that perhaps, if I could save just one mechanical engineering student just a few tens of thousands of hours of linear interpolation time that it would be worth writing a blog article on how to do linear interpolation with Power BI. ![]() So, since I've been on this kick of demonstrating how to do some numerical methods and other math stuff in Power BI, I recalled the dozens, if not tens of thousands, of hours I spent as an undergraduate painstakingly doing linear interpolation to solve Thermodynamics and Fluid Mechanics problems. Homework, tests and final exams seemed like 75% of the time spent was on doing linear interpolation calculations. ![]() Nice enough guy, but looking back at it, probably a bit of a sadist. Jed Marquart, for Thermodynamics and Fluid Mechanics. I know this from my own experience in earning my Mechanical Engineering degree at Ohio Northern University. If you are a mechanical engineer or mechanical engineering student, then you can skip past this introduction and the background information and just get right to the solution. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |