Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hello,
I am a beginner with Power BI/Power Query. And I need help with this task: separating data from two columns, into two others.
In the end I would have "DT_FIM_EXERC_2021" next to ""$ VL_CONTA_2021" and "DT_FIM_EXERC_2022" next to "$ VL_CONTA_2022).
I would like to know if there's anything I can do to organize my Worksheet in this way by using Power Query's powerful data manipulation. Thanks! 🙂
@WilliamPearson I hope this helps you.
Yes, you can definitely use Power Query in Power BI to accomplish this task of separating data from two columns into two other columns based on the values in the "DT_FIM_EXERC" column. Here's a step-by-step guide on how to do this:
1. **Load Your Data:**
- Open your Power BI project.
- Load your data into the Power Query Editor by going to "Home" > "Edit Queries."
2. **Split the Data:**
- In the Power Query Editor, select the table that contains your data.
3. **Add Conditional Columns:**
- Go to the "Add Column" tab.
- Click on "Conditional Column."
4. **Create a Condition for 2021:**
- In the "Conditional Column" dialog, give your new column a name (e.g., "Year_2021").
- For the first condition, choose your "DT_FIM_EXERC" column and set the condition to "equals" 2021.
- In the "Value" box, enter "DT_FIM_EXERC_2021."
5. **Create a Condition for 2022:**
- Click "Add Rule" to add another condition.
- For the second condition, choose your "DT_FIM_EXERC" column and set the condition to "equals" 2022.
- In the "Value" box, enter "DT_FIM_EXERC_2022."
6. **Repeat for the Value Column:**
- Go to the "Add Column" tab again.
- Click on "Conditional Column."
- Create two conditions, similar to what you did for the "DT_FIM_EXERC" column, but this time, use the "$ VL_CONTA" column.
- Name the columns as "$ VL_CONTA_2021" and "$ VL_CONTA_2022" accordingly.
7. **Remove Unnecessary Columns:**
- You can remove the original "DT_FIM_EXERC" and "$ VL_CONTA" columns if you no longer need them.
8. **Close and Apply:**
- Once you have created the new conditional columns and removed the original columns, click the "Close & Apply" button to save your changes and return to Power BI.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.