This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi
I am struggling a little bit to find a solution to correct some data. Here is the data structure:
| Period | Employee ID | Pay Band | Category | Cost |
| 1/1 | 123 | NULL | A | 50 |
| 1/1 | 123 | Band 2 | B | 100 |
| 1/1 | 123 | NULL | C | 12 |
| 2/1 | 123 | NULL | A | 60 |
| 2/1 | 123 | Band 3 | B | 40 |
| 2/1 | 123 | NULL | C | 30 |
My current thinking is to add a Revised Pay Band column that looks up Period and Employee ID and if it finds a Pay Band value that is not null it populates the Revised Pay Band.
Here is the desired outcome but open to suggestions if there is a more optimal solution:
| Period | Employee ID | Pay Band | Category | Cost | Revised Pay Band |
| 1/1 | 123 | NULL | A | 50 | Band 2 |
| 1/1 | 123 | Band 2 | B | 100 | Band 2 |
| 1/1 | 123 | NULL | C | 12 | Band 2 |
| 2/1 | 123 | NULL | A | 60 | Band 3 |
| 2/1 | 123 | Band 3 | B | 40 | Band 3 |
| 2/1 | 123 | NULL | C | 30 | Band 3 |
I have tried it in DAX and couldn't get it working but think this is probably something that should be done in Power Query anyway.
Any help or pointers would be much appreciated!
Thanks
Solved! Go to Solution.
The following code adds a column that returns the first [Pay Band] value that is not null for the value of [Period] and [Employee ID] for the row being evaluated.
Table.AddColumn(#"Previous Step", "revisedPayBand", (x) => List.First(Table.SelectRows(#"Previous Step", each [Period] = x[Period] and [Employee ID] = x[Employee ID] and [Pay Band] <> null)[Pay Band]))
Proud to be a Super User! | |
The following code adds a column that returns the first [Pay Band] value that is not null for the value of [Period] and [Employee ID] for the row being evaluated.
Table.AddColumn(#"Previous Step", "revisedPayBand", (x) => List.First(Table.SelectRows(#"Previous Step", each [Period] = x[Period] and [Employee ID] = x[Employee ID] and [Pay Band] <> null)[Pay Band]))
Proud to be a Super User! | |
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.