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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
A_a_a
Helper III
Helper III

Moving Columns Headers to Rows

Hi All!

 

I have some columns, which show minutes based on calculation time minus time (end time - start time).

 

A_a_a_0-1677167418869.png

 

I want to create matrix table showing total minutes during the hours by day:

A_a_a_1-1677167495184.png

 

Is there any way to have dates as columns and hours as rows? To get such result:

 

A_a_a_2-1677167702685.png

 

Please advice.

 

Thank you,

G.

 

 

 

 

1 ACCEPTED SOLUTION

@A_a_a Well, perhaps you could move the calculations to PQ and then unpivot. Otherwise, you could potentially use this: DAX Unpivot - Microsoft Power BI Community. Last thought, create a disconnected table that just lists your times like:

Time

0:00

1:00

2:00

 

Use this for your rows. Create a measure like this:

Measure =
  VAR __Time = MAX('DisconnectedTable'[Time])
  VAR __Result = 
    SWITCH(__Time,
      "0:00", SUM('Table'[0:00]),
      "1:00", SUM('Table'[1:00]),
      "2:00", SUM('Table'[2:00]),
      ...
    )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5

Anuja_Chaudhari_1-1707468741973.png

 

first I have created this data and you would need to create a calculated table or use DAX measures to generate the desired result.

Anuja_Chaudhari_2-1707468762401.png

Hope you get this helpful. 

 

 

 

 

Greg_Deckler
Community Champion
Community Champion

@A_a_a In Power Query Editor, try unpivoting your time columns.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

 

Thank you for your message.

I don't think I can unpivot them because they are not in power query editor, the columns are added in Data View.

 

What do you think?

 

Thanks,

G.

@A_a_a Well, perhaps you could move the calculations to PQ and then unpivot. Otherwise, you could potentially use this: DAX Unpivot - Microsoft Power BI Community. Last thought, create a disconnected table that just lists your times like:

Time

0:00

1:00

2:00

 

Use this for your rows. Create a measure like this:

Measure =
  VAR __Time = MAX('DisconnectedTable'[Time])
  VAR __Result = 
    SWITCH(__Time,
      "0:00", SUM('Table'[0:00]),
      "1:00", SUM('Table'[1:00]),
      "2:00", SUM('Table'[2:00]),
      ...
    )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

 

Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.