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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
DarylRob
Helper I
Helper I

Unpivot columns but create two value columns

Hi Chaps, 

 

I've got a table like below and I want to be able to unpivot it so it creates an "Hours" column and a "MRR" column but then only one row per quarter...

 

NameQ1 HoursQ2 HoursQ3 Hours Q4 HoursQ1 MRRQ2 MRRQ3 MRRQ4 MRR
Gary10020030040010203040
Trevor10020030040010203040

 

So I'd want an outcome like:

 

NameQuarterHoursMRR
GaryQ110010
GaryQ220020
GaryQ330030
GaryQ440040

 

Thanks,

1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

In power query:

 

1) Unpivot so you end up with:

Gary, Q1 Hours, 100

Gary, Q1 MRR, 10

etc....

 

2) Split the column with rows like Q1 Hours and Q1 MRR into two using either column from example or split column on deliminator (space). Ending up with:

Gary, Q1, Hours, 100

Gary, Q1, MRR, 10

etc....

 

3) You can then pivot to get Hours and MRR as column names.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

3 REPLIES 3
bcdobbs
Community Champion
Community Champion

In power query:

 

1) Unpivot so you end up with:

Gary, Q1 Hours, 100

Gary, Q1 MRR, 10

etc....

 

2) Split the column with rows like Q1 Hours and Q1 MRR into two using either column from example or split column on deliminator (space). Ending up with:

Gary, Q1, Hours, 100

Gary, Q1, MRR, 10

etc....

 

3) You can then pivot to get Hours and MRR as column names.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Perfect, that's two today 😄 thanks mate

bcdobbs
Community Champion
Community Champion

No worries. Once your data is in that sort of form Power Bi makes the rest much easier. Worth reading up on Star Schemas

 

https://docs.microsoft.com/en-us/power-bi/guidance/star-schema

 

and introduction to data modelling in power bi at SQLBI:

 

https://www.sqlbi.com/p/introduction-to-data-modeling-for-power-bi-video-course/

If you get the model right it makes the DAX much easier if needed at all.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.