Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
WesCo_1906
Regular Visitor

Transpose Data: 365 rows/24 columns to 8670 rows/1 column

Hello!  I am a PowerBI Newbie.  I have a one year dataset of hourly monitored sensor data that is in the format of 365 rows (days) /24 columns (hours).  For purposes of a data visualization I'm developing, I would like to convert that dataset to a format of 8670 rows (hours)/1 column.

 

How can I use Power BI to elegantly and efficiently convert that dataset to the 1 column (year) x 8760 rows (hours) format?

365_24_temp.png1_8760_temp.png

4 REPLIES 4
WesCo_1906
Regular Visitor

Thank you!  As a follow up:

1) How do I maintain the sort order created by this transformation to use it for creating chart visualizations?  When I go back to the home view, I lose the sort order created by the transformation.

2) How can I add a column that includes a count for the rows of data in the unpivoted column?

 

 

WesCo_1906_0-1692310597557.png

 

@WesCo_1906 

Your screen shot does not look like your example data.  I would have expected the Attribute column to be 1-24. If you convert it to an whole number you should be able to sort your visual by Date and Hour and it will sort correctly.  You can also add an index column in PowerQuery after you do the transformation if you want.

Hi,

For your second question, write this measure

Ct = countrows(Data)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
jdbuchanan71
Super User
Super User

In PowerQuery, select your Sensor and Date column then go to Transform > Unpivot > Unpivot other columns.

jdbuchanan71_0-1692195066366.png

Then just rename the columns after they are unpivoted and fix the data types if needed.

jdbuchanan71_2-1692195180753.png

 

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.