Forum Discussion
DAX or Power Query - Creating a new column with values from another column
Hi everyone,
I'm facing a problem and decided to ask the community for help.
I have a table with 3 columns - [Country ID], [Factory ID], and [Amount] - and I want to add a new column [Amount (new)] with the logic that's displayed on the example below. What's the best way to achieve this by using either DAX or PowerQuery?
Thank you!
| Country ID | Factory ID | Amount | Amount (new) |
| 1 | 1 | € 432,00 | € 432,00 |
| 1 | 1 | € 432,00 | |
| 1 | 1 | € 432,00 | |
| 1 | 1 | € 432,00 | |
| 1 | 2 | € 869,00 | € 869,00 |
| 1 | 2 | € 869,00 | |
| 1 | 2 | € 869,00 | |
| 1 | 2 | € 869,00 |
- Anonymous4 years ago
Hi Anonymous ,
I suggest you to add an index by group in Power Query Editor and then add a custom column by IF function.
My Sample:
Step1:
For reference:
Create Row Number for Each Group in Power BI using Power Query
Step2:
Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi Anonymous ,
I suggest you to add an index by group in Power Query Editor and then add a custom column by IF function.
My Sample:
Step1:
For reference:
Create Row Number for Each Group in Power BI using Power Query
Step2:
Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.