Forum Discussion
Conditional column in power query
Within power query, how am i able to transform my data to include new columns based on a filtered value of an existing column? I want to recreate the example below
Original output
| ID | Type | Amount |
| 12345 | New | 100 |
| 12345 | Existing | 200 |
| 23456 | New | 200 |
| 23456 | Existing | 200 |
| 34567 | Existing | 500 |
Desired Output:
| ID | New Amount | Existing Amount |
| 12345 | 100 | 200 |
| 23456 | 200 | 200 |
| 34567 | - | 500 |
This is a much simplified example of the data I'm working with, so simply creating measures on the type column won't achieve what I need to create. I need the new and existing amounts to be static data when i'm building as i'll also be creating columns and measures based off of those.
Anonymous,
In Power Query, select the Type column and click Pivot. Choose the settings below:
3 Replies
- DataInsightsSuper User
Anonymous,
In Power Query, select the Type column and click Pivot. Choose the settings below:
- AnonymousNot applicable
Hi Anonymous ,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster .
Thank you very much for your kind cooperation!
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - anmolmalviya05Super User
Hi Anonymous, You can achieve this using the pivot column feature.
Below is an example:
Check Detailed documentation here: https://support.microsoft.com/en-us/office/pivot-columns-power-query-abc9c8da-3be9-44c4-886e-0be331ab387aDid I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Let's Connect on LinkedIn: https://www.linkedin.com/in/anmol-malviya/?originalSubdomain=in