@HufferD
You’ve given me food for thought, I really appreciate that.
Your first paragraph made me chuckle; yes, I do think I need to rethink my plan.
Maybe it would help if I made it clear that the columns I showed in the image were only a subset of the columns provided by the database view that’s my data source; there were also a handful of straightforward numeric columns that will end up in the Fact table. I only showed the columns that have the odd data structure I’m struggling to transform.
How to somehow retain the key that the fact table can recognize as a match when joining is the issue I’ve got to figure out.
Since I wrote my original post, good news is that I convinced the database team who owns this data to include the primary key field in the views that are my data sources, so that will help. They also provided a couple of extra views that avert the need for some of the most numerous of the transformations required (they’re already unpivoted). But that introduces a new challenge: since now 3 tables that each have different data structures must somehow be merged in addition to having to figure out how to pivot the remaining records.
Is it clear that the issue is that each value in the each of the 5 Details columns has to be split by delimiter, with the prefix (part before the delimiter) becoming the column header for post-delimiter part of the values?
I believe it IS necessary to do that reshaping and separating into separate columns because it’s the prefixes my management wants to slice by (Name, Agency, Licenses, Role, Circuit, Project etc.) as they seek ways cut reduce costs.
I’ve been assuming that I should do all of the performance-affecting data structure reshaping in the dimension table or a helper query so that all the fact data doesn’t also have to be shuffled during all the transformations.
But perhaps the transformations MUST be done in a parent query that feeds both the future dim and fact tables so that the linking field isn’t lost.
I’ve actually accomplished doing this by a long series of repetitive conditional statements, but having seen @Melissa demo amazing transformations with helper queries turned into subqueries and custom functions, I hoped to find such a solution in hopes it would be a more robust solution.
Well, thank you for your ideas, @HufferD .
I wish I could ask an AI model how it would solve this, but that’s prohibited in my organization.
Julie