Forum Discussion
Add an extra field from a data source
- 10 years agoAnonymous
If I didn't misunderstood you, when you refresh in power bi desktop your new added column will automatically be imported.
I have this issue also and it is very frustrating. We add addional columns and fields to source csvs all the time.
I have a work around that used to work...until today.
This way you will not lose any of your steps, which is very important especially if you have a complicated report that could break.
The work around is this:
1) refresh everything, make sure the new column is in the source csv
2) under applied steps in query editor, go to source and hit the settings gear icon to right of "source"
3) Choose Open file as "Automatic" hit OK
4) Your table will dissappear, double click the csv file icon, hit "insert" when the insert step box pops up
5) Your newly added column will appear at step 1 "source"
6) to make sure it stays , under "choose columns" or if you have a "removed columns" ...make sure the check box for that new column is checked
7) Your column is good to go now
This usually works. Except today it started giving me a wierd error after applying query edits Which is why I am here searching.
EDIT* I fixed my error. I was being dumb. My work around works again.
What about just changing columns quantity in M query?
I used advanced editor in Data Source:
let
Source = Csv.Document(File.Contents("C:\Users\user\Desktop\AddressType.csv"),[Delimiter="|", Columns=5, Encoding=1200, QuoteStyle=QuoteStyle.None]),
#"Change1" = Table.TransformColumnTypes(Origen,{{"Column1", Int64.Type}, {"Column2", type text}, {"Column3", type text}, {"Column4", type datetime}})
in
#"Change1"In the code (source line), instead of Columns=5, you just change to Coumns=6 and it adds the new column. It worked for me.
- LouisT9 years agoRegular Visitor
When you modify the Data Source as reneincer suggested, you will not find "Columns=X" in the code when working with an Excel file. I worked around that by simply going into the second line of the code and inserting my new column names in the code line. i.e. - add {"Column2.5", type text} after the "Column2" piece in the code.
Worked perfectly.
Thanks for the suggestion reneincer!
- dan_hoff9 years agoHelper I
thanks reneincer
that worked amazingly well.... edit query then just 'up' the Columns= by one
perfect
- Rodion8 years agoFrequent Visitor
Thanks, this is by for the most simple solution. It also helps me to understand how to work with M query and the advanced editor, which is a big plus I you're new to this.
- LouisT8 years agoRegular Visitor
Rodion, Glad it worked for you too! :)