Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
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 April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |