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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PhillipB
Frequent Visitor

Data with an uncertain start point

I am working with testing data and there is a complication as to when the test is started.  The data is recorded automatically and relates to engine RPM and oil pressure.  The recording starts as soon as the engine is switched on but the test can actually start at some point later and this varies by several minutes per test.

 

We can see when the test starts as the RPM of the engine is raised to 1850 RPM, the first occurence of 1850 is when the 0 needs to be.  I need to have this as the 0 point for the test with all other enties prior to this point to be negative and then positive after.

 

RPMPressureTime - secRelative Time
800991145-1
18509951460
1850994

147

1
8009911482
8009921493
18509941504

 

The blue values are the ones I need to create.

 

Any help would be much appreciated.

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

In Power Query

Starting with

jgeddes_0-1670251485016.png

-add an index column starting from 1

Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)

-find the lowest value of the index column where the RPM = 1850

Table.AddColumn(#"Added Index", "initialZero", each List.Min(Table.SelectRows(#"Added Index", (x)=>x[RPM]=1850)[Index]) )

-subtract the initialZero column from the Index column

Table.AddColumn(#"Added Custom", "Relative Time", each [Index] - [initialZero])

-remove the Index and intialZero columns

Table.RemoveColumns(#"Added Custom1",{"Index", "initialZero"})

and you should end up with

jgeddes_1-1670251685360.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
PhillipB
Frequent Visitor

Thanks, I think that will do what we need.

jgeddes
Super User
Super User

In Power Query

Starting with

jgeddes_0-1670251485016.png

-add an index column starting from 1

Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)

-find the lowest value of the index column where the RPM = 1850

Table.AddColumn(#"Added Index", "initialZero", each List.Min(Table.SelectRows(#"Added Index", (x)=>x[RPM]=1850)[Index]) )

-subtract the initialZero column from the Index column

Table.AddColumn(#"Added Custom", "Relative Time", each [Index] - [initialZero])

-remove the Index and intialZero columns

Table.RemoveColumns(#"Added Custom1",{"Index", "initialZero"})

and you should end up with

jgeddes_1-1670251685360.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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