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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Chetanab
Employee
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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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