• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Re using Query modified in the data model|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Re using Query modified in the data model|Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryRe using Query modified in the data…
sp_PrintTopic sp_TopicIcon
Re using Query modified in the data model
Avatar
Kent Burkhardt
Member
Members
Level 0
Forum Posts: 8
Member Since:
December 15, 2017
sp_UserOfflineSmall Offline
1
January 7, 2021 - 6:37 am
sp_Permalink sp_Print

I have created a query initially using PowerQuery, and performed some transformations.  Then, in the Data Model, I made some additional changes in order to get the data how it was needed.

Now, I would like to re-use this modified query, but when I open Get Data / From Other Sources / Blank Query / Advanced Editor, and paste the query in, i get an error, "Expression.SyntaxError: Token Eof expected".  

How does one re-use a query that has been modified in the Data Model?  I cannot paste the work book, but here is the Query that I get when I right click the query, and am trying to paste into Advanced Editor.  

 

let
Source = Folder.Files("FIle Path"),
#"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content])),
#"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
#"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File"}),
#"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", Table.ColumnNames(#"Transform File"(#"Sample File"))),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Site", type text}, {"Location", type text}, {"Sub Location", type text}, {"Date of Inspection", type date}, {"Equipment Type (System)", type text}, {"UniFormat Class", type text}, {"OmniClass", type text}, {"Manufacturer", type text}, {"Model", type text}, {"Serial", type text}, {"Asset ID", type any}, {"Install Date", type date}, {"Functioning", type text}, {"Remaining Life", Int64.Type}, {"Condition", type text}, {"Repair Cost", Int64.Type}, {"Inspector Name", type text}, {"Special Considerations", type text}, {"Inspector Notes", type text}, {"Building", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Source.Name"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Columns", each true),
#"Changed Type1" = Table.TransformColumnTypes(#"Filtered Rows",{{"Asset ID", type text}, {"Install Date", type date}, {"Remaining Life", Int64.Type}}),
#"Filtered Rows1" = Table.SelectRows(#"Changed Type1", each true),
#"Replaced Value" = Table.ReplaceValue(#"Filtered Rows1","poor","Poor",Replacer.ReplaceText,{"Condition"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","good","Good",Replacer.ReplaceText,{"Condition"}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","poor","Poor",Replacer.ReplaceText,{"Condition"}),
#"Filtered Rows2" = Table.SelectRows(#"Replaced Value2", each true),
#"Replaced Value3" = Table.ReplaceValue(#"Filtered Rows2","fair","Fair",Replacer.ReplaceText,{"Condition"}),
#"Replaced Value4" = Table.ReplaceValue(#"Replaced Value3","GOOD","Good",Replacer.ReplaceText,{"Condition"}),
#"Filtered Rows3" = Table.SelectRows(#"Replaced Value4", each true),
#"Duplicated Column" = Table.DuplicateColumn(#"Filtered Rows3", "Condition", "Condition - Copy"),
#"Reordered Columns" = Table.ReorderColumns(#"Duplicated Column",{"Site", "Location", "Sub Location", "Date of Inspection", "Equipment Type (System)", "UniFormat Class", "OmniClass", "Manufacturer", "Model", "Serial", "Asset ID", "Install Date", "Functioning", "Remaining Life", "Condition", "Condition - Copy", "Repair Cost", "Inspector Name", "Special Considerations", "Inspector Notes", "Building"}),
#"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Condition - Copy", "Condition Order"}}),
#"Replaced Value5" = Table.ReplaceValue(#"Renamed Columns","Poor","4",Replacer.ReplaceText,{"Condition Order"}),
#"Replaced Value6" = Table.ReplaceValue(#"Replaced Value5","Fair","3",Replacer.ReplaceText,{"Condition Order"}),
#"Replaced Value7" = Table.ReplaceValue(#"Replaced Value6","Good","2",Replacer.ReplaceText,{"Condition Order"}),
#"Replaced Value8" = Table.ReplaceValue(#"Replaced Value7","N/A","1",Replacer.ReplaceText,{"Condition Order"})
in
#"Replaced Value8"

// Transform File
let
Source = (Parameter1) => let
Source = Excel.Workbook(Parameter1, null, true),
Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data]
in
Table1_Table
in
Source

// Sample File
let
Source = Folder.Files("File Path"),
Navigation1 = Source{0}[Content]
in
Navigation1

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
January 7, 2021 - 1:38 pm
sp_Permalink sp_Print

Hi Kent,
You are pasting 3 queries into 1, the 2 queries from the bottom should be separate queries (Transform File and Sample file)

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Dieneba NDIAYE, Mark Carlson
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Debi Morgan
yashal minahil
Oluwadamilola Ogun
Yannik H
dectator mang
Francis Drouillard
Orlando Inocente
Jovitha Clemence
Maloxat Axmatovna
Ricardo Freitas
Forum Stats:
Groups: 3
Forums: 24
Topics: 6201
Posts: 27185

 

Member Stats:
Guest Posters: 49
Members: 31861
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.