Pivoting multiple date columns into one

Hi guys,

Looking for some help from those smarter than myself.

I have multiple start and end date columns for 4 different activity types. I want to show these activities within a calendar but am having difficulty in doing so. From what i have read, i need to have the current 4 start and 4 end columns consolidated into one start and end?

I’m handy with Excel and Power Query so was trying to look for a pivot/unpivot columns functionality - unsure if this is the right approach within Glide?

Ideally i would have a solution that keeps everything in the same table, but happy to create a new/helper table if needed.

Question: do you need to visualise the dates for all Projects at once on a single calendar, or would it just be for the specific Project being viewed?

1 Like

Just a hint for you, if you want to use Power Query in your Excel, Glide don’t run Power Query Syncs.

Would like the dates for all Projects in one calendar (using this as an headline overview).

In my head i need to perform a transformation like this?;

Thanks. Trying to avoid using Excel/Google Sheets at all for this project. Hoping to contain everything within Glide

1 Like

Is that conversion a one time thing or recurrent thing?

Will be ongoing - new projects added constantly

How are data inserted? From a form in Glide? If it does, you could do a onSubmit action that insert the the id in a new table. In that new table, you could add computed column to create the relation and lookup/single value for related data you need in the first table.

yes, using form in Glide.
Im still fumbling my way through Glide. Do you have any links or dumbed down steps to expand on this solution?

1 Like

Yes, I will check that for you.

Here it is!

Your main table (“Empty table” for the example) is the one the form uses to insert data:


Let’s say that we have name and description.

Here is the form container mapped to the “empty table”:

Then, you want to create a second table with the column you want to get from the first table:
Name, description, based on the related row id used to make the relation between the 2 tables and create the lookups you need:

Then, you want to create a onSubmit action on the form. You will set an Add row action to insert the row id of the first table after submission into the related row id column of the new table:

Then, to test it, submit something. It will insert a row in the empty table, then it will insert a row in the new table with one value in the related row id (the new inserted row from empty table).
So, the lookups will grabe the data from the first table based on the related row id:

That way, you will be able to use template column and if then else, to build your final 4 columns you need!

Sorry I think I misunderstood your question… The pivot thing is the problem? Or you are open to change the way data are inserted to the table?

appreciate the detailed response but im not sure this will work in my scenario.

  1. for each project (ie row) in my main table there are 4 activities/sub tasks (1. Consult 2. Stage 3. Touch up 4. Pick Up). Each of these activities MAY have dates. In your solution, i believe i would need to add 4 new rows into the new table for each of these activities. Is that right? How would i do this?

  2. These dates can be amended/updated. Would these updates flow through to the new table?

In the form users are filling, can they choose the dates for all 4 tasks?

yes they can

Okay, let me add the action you need and Ill send it here.

Here we go.

So first, I recreated the first table with your current configuration:

Then, I created a second table with 2 basic text column: one for project row id and one for activity. The others are shown here:

The relation allow to link the rows to the project in the main table:

The lookup are used to grap the project name and all the date columns:

Add two if then else columns: (start, end)



Set the conditions.

You can hide columns for more simplicity:

In the form container, create a new workflow in the onsubmit event and set four add rows for each activity as shown here:

Let’s test it out!

My advice would be to normalise your data structure. Get rid of all those date columns in your Projects table, and create a separate link table - let’s call that Project Milestones.

In that table, add the following columns:

  • ProjectID
  • Milestone (name or ID)
  • Start Date
  • End Date

With that structure it is easy, you can use that table as the source of your Calendar, and no transformation or other computed column gymnastics is needed.

2 Likes

Thanks Maxime. Will have a play with this tonight. Very much appreciate the effort you have gone to help!

1 Like

My pleasure!