Forum Discussion

wolfboyjan's avatar
wolfboyjan
New Member
3 years ago

Creating an Index in Power BI - help with calculating based on current row value

I'm trying to create an Index of times, to show whether individual runners are getting faster or slower over time, with a runner's first time as 100.0 and any decrease in future times being expressed as a reduction, e.g. a 10% faster time would be expressed as 90.0, and so on.

 

I understand how to achieve this in a couple of ways using Excel, with some combination of MINIFS and pivot tables, but I'd like to do this in Power BI.

 

I thought it would be quite straightforward to create a column that shows a runners first time and then to use this to further calculate the Index value (time / first time), but I don't seem to be able to achieve this.

 

Here's an extract of the "data" table where the information is held:

 

event_nameevent_dateevent_numberrunner_positionrunner_namerunner_genderrunner_time
Lyme Park parkrun25/02/20233901Runner aMale00:19:20
Lyme Park parkrun25/02/20233902Runner bMale00:20:32
Lyme Park parkrun25/02/20233903Runner cMale00:20:40
Lyme Park parkrun25/02/20233904Runner dMale00:21:45
Lyme Park parkrun04/03/20233911Runner eMale00:18:46

 

And here's the custom column I have tried to create, which currently only works when I manually enter a runner's name ("John Smith" in the example below):

 

First_time = LOOKUPVALUE(data[runner_time],data[runner_name],"John Smith",data[event_date],data[First_week])

 

In Excel I would simply refer to the specific cell within the current row of the "runner_name" column, but I realise this isn't the right approach in Power BI. I have searched online and tried to use the EARLIER function, but receive error messages which I have been unable to resolve.

 

Any help with this and/or how to produce the Index I described would be really appreciated!

7 Replies