Forum Discussion
JoaoMS
Helper III
3 years agoCreate colum with the difference of two rows
Hi all, I've been trying to figure out how to create a new column in Power Query in order to calculate the difference between two values of some columns. Every day we get data of Accumulated Oper...
- 3 years ago
Hi,
You may download my PBI file.
Hope this helps.
JoaoMS
Helper III
3 years agoHi Ashish_Mathur , so you mean that it is more complicated to create these new columns in Power Query, because what we currently do is manually calculate these data in the source excel file, and then in Power Query we treat the data (unpivot and pivot) in order to get the following table and then easily create some visualizations:
| Date | Motor | Daily Hour | Acc. Hours |
| 28/04/2023 | Motor 1 | - | 15,400 |
| 28/04/2023 | Motor 2 | - | 8,752 |
| 29/04/2023 | Motor 1 | 24 | 15,424 |
| 29/04/2023 | Motor 2 | 12 | 8,764 |
| 30/04/2023 | Motor 1 | 4 | 15,428 |
| 30/04/2023 | Motor 2 | 21 | 8,785 |
Thanks,
Joao
Ashish_Mathur
Super User
3 years agoHi,
I would not suggest writing those custom column formulas in the Query Editor. After unpivoting the raw dataset, we can write DAX measures to calculate the hours of each day. If you need further help, then share the data with information of 10 motors (columns).
- JoaoMS3 years ago
Helper III
- Ashish_Mathur3 years ago
Super User
Hi,
You may download my PBI file.
Hope this helps.