Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
RPM | Pressure | Time - sec | Relative Time |
800 | 991 | 145 | -1 |
1850 | 995 | 146 | 0 |
1850 | 994 | 147 | 1 |
800 | 991 | 148 | 2 |
800 | 992 | 149 | 3 |
1850 | 994 | 150 | 4 |
The blue values are the ones I need to create.
Any help would be much appreciated.
Solved! Go to Solution.
In Power Query
Starting with
-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
Proud to be a Super User! | |
Thanks, I think that will do what we need.
In Power Query
Starting with
-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
Proud to be a Super User! | |
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
102 | |
99 | |
38 | |
37 |
User | Count |
---|---|
158 | |
125 | |
76 | |
74 | |
63 |