Forum Discussion

ale259's avatar
ale259
Helper I
1 year ago
Solved

Pivot Columns Excel/ Power Query

Hello,  I have the dateset as below (with fictional number) Hourly A City B City 12:00 AM 1000 200 1:00 AM 5000 400 2:00 AM 7000 6000 3:00 AM 8000 7000 4:00 AM 10000 8...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi ale259,

     

    Thank you for reaching out to Microsoft Fabric Community Forum.

     

    Load the data into Power BI and open Power Query Editor by selecting Transform Data.
    You can proceed step by step in Power Query to achieve your expected output.

     

    Ensure the date column is converted to a time-only format. To do this, select the column and choose Time from the Data Type dropdown. This will display only the hourly values.

     

    Select only the "Hourly" column, then go to Transform → Unpivot Other Columns. This will convert "A City" and "B City" into two columns: "Attribute" and "Value".

    Rename "Attribute" to "City" and "Value" to "Visits".

     

    Sort it from the filters dropdown in ascending or descending order.

     

    Here is the output.

     

     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!

     

    Regards,

    Vinay Pabbu