- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Get value from previous grouped index number in a new column (Powerquery or DAX)
Hi!
Can somebody help me out with a solution to generate the column "previous Index OVerall_avg_Score" as presented in the image below. Preferably i'd like to get this result in PowerQuery, but DAX solutions are also welcome. The dataset is presented below the image.
I've looked up various solutions, but they are mainly focused on date-related measures or they do not work with a group of index numbers as shown in this example. Your help is greatly appreciated!
Index | Project_Code | Overall_Avg_Score |
1 | 7304100171 | 2 |
1 | 7304210056 | 2,4 |
1 | 7304210032 | 1 |
1 | 7304210053 | 0 |
1 | 7304210033 | 0 |
2 | 7304100171 | 3 |
2 | 7304210056 | 2,3 |
2 | 7304210032 | 2,4 |
2 | 7304210053 | 0 |
2 | 7304210033 | 0 |
3 | 7304100171 | 2,4 |
3 | 7304210056 | 2,2 |
3 | 7304210032 | 2,4 |
3 | 7304210053 | 0 |
3 | 7304210033 | 0 |
4 | 7304100171 | 1,5 |
4 | 7304210056 | 1,6 |
4 | 7304210032 | 2 |
4 | 7304210053 | 0 |
4 | 7304210033 | 0 |
5 | 7304100171 | 3 |
5 | 7304210056 | 2,7 |
5 | 7304210032 | 2,8 |
5 | 7304210053 | 0,6 |
5 | 7304210033 | 2,1 |
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had to do something similar a few months ago
With Power query:
You create a column called PreviousIndex: Index -1
Then you make a self join using Index & Project Code AND PreviousIndex & Project Code
In dax:
You create a calculated columns with a PreviousIndex, you create two calculated column in your source table: Index & Project Code and in the calculated column: reviousIndex & Project Code
You link your two tables and then you use
NATURALLEFTOUTERJOIN(SourceTable, CalculatedTable)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had to do something similar a few months ago
With Power query:
You create a column called PreviousIndex: Index -1
Then you make a self join using Index & Project Code AND PreviousIndex & Project Code
In dax:
You create a calculated columns with a PreviousIndex, you create two calculated column in your source table: Index & Project Code and in the calculated column: reviousIndex & Project Code
You link your two tables and then you use
NATURALLEFTOUTERJOIN(SourceTable, CalculatedTable)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks so much, the PowerQuery solution you provided worked! This issue bothered me for a long time already. Thank you so much!

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
07-03-2024 06:34 AM | |||
01-25-2024 07:21 AM | |||
02-21-2024 01:17 PM | |||
04-05-2024 07:02 AM | |||
Anonymous
| 01-25-2024 03:10 AM |
User | Count |
---|---|
19 | |
13 | |
11 | |
10 | |
7 |