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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Chetanab
Microsoft Employee
Microsoft Employee

Unpivoting multiple date columns

Hi,

 

I have a table like this - 

 

TitleRequest Start DateRequest End DateTargeted Start DateTargeted End DateActual Start DateActual End Date
Item 17/30/20219/30/20217/30/20219/30/20215/30/20217/30/2021
Item 27/30/20219/30/20217/30/20219/30/20215/30/2021

7/30/2021

 

I need to transform it to something like this

TitleDate CategoryStart DateEnd Date
Item 1Request Date7/30/20219/30/2021
Item 1Targeted Date7/30/20219/30/2021
Item 1Actual Date5/30/20217/30/2021
Item 2Request Date7/30/20219/30/2021
Item 2Targeted Date7/30/20219/30/2021
Item 2Actual Date5/30/20217/30/2021

 

I tried unpivoting all the start date columns and the end date columns from the first table but that gives me a cartesian product. IS there a way to do thi

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Select the first column. Unpivot the othe columns.

Split the centre column (by space, once as far left as possible)

Select the new column that has 'start date' and 'end date' in it. Pivot this column. Choose Value(the date column) as Values. Choose Don't Aggregate from the advanced.

That should be it.

View solution in original post

2 REPLIES 2
Chetanab
Microsoft Employee
Microsoft Employee

Perfect. Thank you.

HotChilli
Super User
Super User

Select the first column. Unpivot the othe columns.

Split the centre column (by space, once as far left as possible)

Select the new column that has 'start date' and 'end date' in it. Pivot this column. Choose Value(the date column) as Values. Choose Don't Aggregate from the advanced.

That should be it.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.