Forum Discussion
Import union DAX statement into data model?
Hi lowndsy
Not sure on your approach here.
Have you used Power Query to pull data into the data model?
I don't think so - just Power Pivot, if that makes sense? I got the method I used from a recommendation on a blog somewhere, but if there is a better way I'll happily do that.
The aim is just to get one perfect list of unique keys on one side of the 1: many relationship so I can enrich it with data from the csv data, which is full of blanks.
1) Import csv files into Data model (legacy text wizard, connection only, prompt for file name on refresh)
2) Dump some columns back into the sheet as a table using a DAX query - with a few filters
3) Add that cleaned table back to the data model as a new source with power pivot > add to data model
Step 3 Is where it fails - when I use a UNION to run the same query but on different columns, Excel gets upset, which is understandable because it is connecting to the same table twice.
The csvs come from an external system and I want to avoid manually editing them.
I am basically building something where anyone in the office can click "refresh all", select the latest files and go for a cup of tea while it crunches away.
I am happy enough with what I have so far, but it means I need there copies of the same system. Getting the UNION thing going (or equivalent) would be the icing on the cake and let me smush it all together into one file.
I would be a hero in the office. Gentlemen doff their caps, ladies would want to know me. Doors would open and Dogs would wag their tails at me. Or it could just save our us a load of pointless work every day - I'm easy.
Thanks,
Steve