Forum Discussion

Shana_Nasrin's avatar
Shana_Nasrin
Helper I
1 year ago
Solved

How to avoid repeated rows after unpivoting in power query?

Hi, I have a dataset containing columns Jan 2025 - Dec 2025, each column contains the number of consumption of a particular product in that month. Another set of columns same from Jan 2025 - Dec 202...
  • v-hashadapu's avatar
    1 year ago

    Hi Shana_Nasrin , Thank you for reaching out to the Microsoft Community Forum.

     

    Your values were off because consumption and cost were unpivoted separately, which left you with two different Month columns. When those got combined in visuals, Power BI duplicated rows and inflated the sums.

     

    To show you the fix, we built a sample dataset based on our understanding of your scenario. We unpivoted all month columns at once, split the combined header into a single Month column and a Type column, then pivoted Type back into two numeric columns. This creates one clean table (one row per product per month), so totals stay accurate.

     

    We also added a proper date column for sorting, so months now appear in the correct order on your charts. You can see all the steps and working visuals in the attached .pbix built on the sample data.

     

    We attached the .pbix file for your reference and share your thoughts.