From the course: Learning Data Analytics: 1 Foundations

Solution: Rename headers in Power Query

From the course: Learning Data Analytics: 1 Foundations

Solution: Rename headers in Power Query

(upbeat music) - [Instructor] You may or may not have enjoyed that challenge just depending on how much you like or don't like code, let me show you how I would tackle it. So I have my study data open, let me navigate to that. And I've also got a new workbook open so I'm going to just switch between my windows there. I'll go to my visual basic and I've got my different pieces of code. Okay, so I'm going to go ahead and size my window and then choose my book here, all right. So I'm going to size this up because I really want to be able to see both. In our objective it said to bring open a new workbook and clean it in. So I'll go to data, get data from file, I'll choose workbook. I'll navigate to my challenge data. I'll choose remote work study. And I'll go ahead and choose transform. I'll restore my power query window because I do want to be able to see my code. So my very first steps are to delete columns D through G. So this would be A, B, C, D, E, F and G. So I'll hold my shift key, I'll then right click and remove those columns, okay? My next step is to remove that extra row so that means this field right here. So it says row two. So row one is my column headings. So my row one in power query is my data. So I'll just go here and uncheck that null. Perfect, okay. Let me go back over and do closing load. So I'm good. So far scroll down where I can see my headings, okay. Give myself plenty of room here, all right. Let me right click and go back to edit. And again, I have to size 'cause I want to be able to see. It's great if you have dual screens. All right, so what is your age? Obviously, it's going to be called age. What is your highest level of education? Obviously is going to be called education, seniority level. Rename that to senior level, classify employment status. We named that employee status then our last but not least is do you consider yourself a remote worker and then this remote worker. Perfect, I think I've accomplished all my steps. I'll be closing load. All right, I'll go ahead and close my window there. And now what I want to do is actually compare it to my original scenario. So let me go ahead and do file closing return. Move this over and I see, responder ID. Collector ID, start date, age, education, senior level, employee status and remote worker. Okay, education, senior level, employee status and remote worker. Looks like I got it. I hope you enjoyed this challenge. Again, VBA and macros are amazing automation and you can use them to leverage tools like power query to repeat those routines without all the overhead of the code.

Contents