Forum Discussion

Jasmine07's avatar
Jasmine07
Regular Visitor
5 months ago
Solved

Power BI Pivot Columns ?

Hi all, I’m trying to pivot two columns in my dataset in Power BI. While retaining all values exactly as they are, even if they are repeated (i.e. no aggregation such as sum or average). However...
  • cengizhanarslan's avatar
    5 months ago

    From your screenshot, your query already ends with:

     in
    #"Renamed Columns2" 
     

    Then you pasted another let ... in ... block underneath. Power Query can only have one let … in … per query. So you must either:

    • Replace the entire query with the new code, or

    Create a New Query and paste the code there.

    Seems like your problem lies in here.

     

    So instead of mixing the code in a wrong way try using the UI of power query. Also could help if you share your .pbix or full code.

    1. In Power Query Editor, select the column that should become the new column headers.
    2. Go to Transform → Pivot Column.
    3. Choose the column that contains the values.
    4. Select an aggregation (usually Sum, Max, or Don't Aggregate if each key is unique).