Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Table 1 (Forecasts) has Parts column, unit price and 24 columns showing the 24 months starting from Jan'23 to Dec'24. I unpivoted those columns in Power Query to get one column as 'Month'. Hence, each FCST part now will have 24 rows of data showing the forecasted units every month for 24 months.
In table 2, I have the same Parts Column called Shipped Parts. I grouped the data by part and by month and aggregated by Shipped Qty. It gave me 3 columns. Parts, Month, Qty.
Now, I want to see the parts, month, shipped qty and forecasted qty together in this format.
Upon doing a merge using either left outer, right outer or full outer joins, I am getting 6 rows for each part for each month. I just want to see Part A, Jan, Shipped units and forecasted units in Jan and for other months.
How can I achieve this in Power Query?
Solved! Go to Solution.
Hi divyamalhotra12.
There are a few things which may be causing your issues:
I tried doing what you mentioned but it somehow shows me two entries per part.
Is there any other way apart from merge to perform this operation? Can I use the add column feature somehow?
Also, I believe unpivoting the column is not helping at all. For instance, when i click on unpivot column by selecting all 24 columns showing the 24 months then idelally it should show the sum of column 1/1/2023 corresponding the part ID but it does not do that. It is just taking the first value. How can I ensure that I see the sum of the month of jan'23 against the Part ID?
Could you perhaps share some sample data of both of your tables and we can work together on creating a sample solution with those?
You can read about the unpivot operation from the link below:
Unpivot columns - Power Query | Microsoft Learn
It doesn't do any sort of aggregation, but you can do the aggregations doing a Group By for example. Below is the link to the documentation around the Group By feature:
How to GROUP BY or summarize rows - Power Query | Microsoft Learn
Forecasted Data - Data goes on from 1/23 to 12/24
Shipments Data - Data goes on from 1/23 to 5/23
I need to see this output in power query in data factory.
Can you share the Power Query script that you've created to better unerdstand how things are working today for you?
You can go into the View tab in the ribbon and then select the "Advanced Editor" to show the dialog. Then just copy-paste to here and make sure to remove any personal information from the code that you do not wish to publicly share.
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.
Thanks.
any way that you can share the data as a table and not an image? or perhaps a sample file that we could access?
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.
Thanks.
Hey!
Could you share a screenshot on how you're doing the merge between both tables? I'd definitely use both the Month and the parts columns as the fields to use for the merge. Not just one of them.
Hi divyamalhotra12.
There are a few things which may be causing your issues:
The merge worked properly using this solution. There was a problem with unpivit column operation I was performing prior to merging. Once, that got fixed, the merge operation worked properly
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
3 | |
3 | |
2 | |
2 | |
2 |